This guide will provide you with step by step details on how to integrate the SDK in just a few minutes. The following steps outline the integration process in details.
- Step 1 : Download the appunfold framework
- Step 2 : Attach appunfold framework to your iOS project
- Step 3 : Initiate the appunfold framework
If you are using Cocoapods or Carthage, skip Step 1 & Step 2, go directly to Step 3.
Add
pod 'Appunfold', '~> 1.0'
to your Podfile.
In terminal, go to the folder of your project and enter pod install
. Open <your-project-name.xcworkspace>
Add
github "Appunfold/ios-sdk"
to your Cartfile. In terminal, go to the folder of your project and enter carthage update
Download the appunfold sdk from here
Alternatively you can clone the appunfold github repo
git clone https://github.com/appunfold/ios-sdk
The appunfold.framework is to be copied into your project folder.
- Click on the project folder on the project navigator panel.
- Click on the application under Targets and go to the General tab as shown in image below
- Click on + button under Embedded Binaries as shown in image below.
- Click on Add Other from the dialog that appears.
- Select appunfold.framework from the project folder.
- If prompted with a dialog that asks whether to copy the framework, click on Yes.
-
In your AppDelegate file, import the appunfold framework
Swift :
import appunfold
Objective-C:
#import <appunfold/appunfold.h>
-
In the
didFinishLaunchingWithOptions:
method initiate the appunfold sdk using the initMethod as shown belowSwift :
func application(_application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { //Override point for customization after application launch. AppunfoldSDK.sharedInstance().initWithAPIKey("<YOUR-API-KEY>") }
Objective-C :
-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. [[AppunfoldSDK sharedInstance] initWithAPIKey:@"<YOUR-API_KEY>"]; }
Note - The API-KEY can be obtained from the integration page of your app in the appunfold dashboard.
You can track your user's activity with our tools. For that to happen, you have to map user information. This mapping can by done by using following api:
Swift
AppunfoldSDK.sharedInstance().setUserWithId("<User-Id>",
username : "<username>",
email : "<email>",
andParameters : ["<param1>":"<value1>","<param2>":"<value2>"])
Objective C
[[AppunfoldSDK sharedInstance] setUserWithId:@"<User-Id>"
username:@"<Username>"
email:@"<Email>"
andParameters:@{@"<param1>":@"<value1>",@"<param2>":@"<value2>"}];
This API identifies individual users and maps corresponding analytical data. All the parameters except userid are optional. You can add any number of parameters in the dictionary parameters provided in the api.
Please note that you have to intialise the AppunfoldSDK before using this API.
-
You can control the visibility of AppunfoldSDK's help center by your code. It can be done using following api
Swift :
AppunfoldSDK.sharedInstance().showHelpCenter()
Objective C :
[[AppunfoldSDK sharedInstance] showHelpCenter];
-
To know if the FAB button is currently enabled for your application the following api can be used
Swift :
let x = AppunfoldSDK.sharedInstance().isFABEnabled() // x will be `true` if fab is enabled; `false` if not
Objective C :
BOOL x = [[AppunfoldSDK sharedInstance] isFABEnabled]; // x will be `YES` is fab is enabled; `NO` if not
To enable/disable FAB the below mentioned API can be used
Swift :
AppunfoldSDK.sharedInstance().enableFAB(<true/false>)
Objective C :
[[AppunfoldSDK sharedInstance] enableFAB:<YES/NO>];