IOS SDK : Download and Setup
Registration and Download
This is the first step to integrating an app with BleshCMS. Registering creates a Blesh account and provides access to everything needed to get started. You can sign up by clicking this link.
You can download the IOS SDK by clicking this link.
Register to Download
You will have to be registered to BleshCMS to be able to download the IOS SDK.
Including Framework in Your Xcode Project
Before starting with this guide please download the IOS BleshSDK framework first.
Import BleshSDK framework in your Xcode project. You can find the reference image below.
Adding Other Frameworks to Your Xcode Project
In your Xcode Project click on Project Settings and find the Build Phases tab. Down below you will find the Link Binary With Libraries section, continue by clicking on the plus icon(+). On the popup window, click on"Add other..." at the bottom and select a library file. Repeat these steps for the remaining libraries:
- Accelerate.framework
- AudioToolBox.framework
- BleshSDK.framework
- CoreLocation.framework
- SystemConfiguration.framework
- UIKit.framework
- CoreBluetooth.framework
- CoreTelephony.framework
- Foundation.framework
- CoreGraphics.famework
Configuring Info.Plist
To provide the best UX to your subscribers you will need to have permission after your application is installed. Each iOS User guide app may ask for required permission in their own sentences. These configurations can be tuned under Info.plist folder.
You can, of course, get more privileges, but NSLocationAlwaysUsage permission is required for best iBeacon UX. If, you are unable to get or the subscriber does not give It's permission, your app won't get notified when It's running in the background.
Info.plist
Key: NSLocationAlwaysUsageDescription
Value: āYour app requires this permission for serving with the best resultsā
Blesh Notification Sound
Include BleshNotification.caf in your resources. It will appear as below.
You can download the sound file from this link.
Defining AppDelegate
Lets do some coding now.
BleshSDK needs to be defined in AppDelegate as shown below. This will also help your application to manage local notifications.
#import <BleshSDK/Blesh.h>
-(BOOL) application: (UIApplication*)application
didFinishLaunchingWithOptions: (NSDictionary*)launchOptions
{
UILocalNotification* notification =[launchOptions
objectForKey:UIApplicationLaunchOptionsLocalNotificationKey];
if(notification){
[[Blesh sharedInstance] bleshReceivedLocalNotification:notification];
}
return YES;
}
-(void) application: (UIApplication*)application
didReceiveLocalNotification: (UILocalNotification*)notification {
[[Blesh sharedInstance] bleshReceivedLocalNotification:notification];
}
-(void) application: (UIApplication*)application
handleActionWithIdentifier: (NSString*)identifier
forLocalNotification: (UILocalNotification*)notification
completionHandler: (void(^)())completionHandler{
[[Blesh sharedInstance] bleshReceivedLocalNotification:notification];
completionHandler();
}
Initializing The SDK
Now you can provide information about your subscriber to the platform.
This step involves initializing the BleshSDK in your project once the user credentials are received. If you do not have an APIUser and an APIKey please log-in to the BleshCMS Platform. APIUser and APIKey are shown next to application definition in your account.
Integration Type needs to be āMā. Integration-Id field is for the unique subscriber token. You can give any information which makes the subscriber unique in your applicationās understanding.
[[Blesh sharedInstance] initBleshWithAPIUser:@"application.apiUser"
APIKey:@"application.apiKey"
integrationType:@"M"
integrationId:@"BleshCMS"
pushToken:@"Push Notification Token"
optionalKey:@"Optional Key"
showLogs:YES];
Receiving User Interaction Notice
Once the user receives the push notification and opens it; BleshSDK will inform your app that the user has interacted with your content. In order to receive this information, implement the code block below to your app.
[[Blesh sharedInstance] setDidCloseCampaignView:^(NSString* valueType,NSString* value){}];
Thatās all. Now you can assign a campaign using Blesh CMS Platform ā My Campaigns section.
If you have an iBeacon, you can also experience the iBeacon campaign from your application. In order to do that, donāt forget to mount your iBeacon with the corresponding UUID, Major and Minor values to the Blesh CMS Platform.
Canāt get enough? Try our community pages for further information and pro tips or you can always contact us at [email protected].
Updated less than a minute ago
