Deep linking - Objective-C¶
Deep linking consists of using a uniform resource identifier (URI) that links to a specific location within a mobile app rather than simply launching the app.
Examples of URIs that launch a mobile app:
- twitter:// is the iOS URI to launch Twitter’s mobile app
- YouTube:// is the iOS URI to launch YouTube’s mobile app
Pulse provides a “Deep linking” capability to pass data directly to an app for processing and performing interactions. Follow the instructions to use this feature in your app.
Add the PulseSDKDelegate protocol in your AppDelegate.h file
@interface AppDelegate : UIResponder< UIApplicationDelegate, PulseSDKDelegate>
Set the delegate to self in didFinishLaunchingWithOptions method.
-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[PulseSDK sharedClient].delegate=self;
...
}
Implement the delegate protocol in your AppDelegate.m file.
The SDK will directly handle “http”, “tel” and “email” urls if a user clicks on a local notification to launch the app.
-(void)didReceiveDeepLinkNotification:(NSString *)notification{
NSLog(@"Data received is :%@", notification);
if(!([notification rangeOfString:@"http"].location==NSNotFound)){
//http url received
}
if(!([notification rangeOfString:@"tel"].location==NSNotFound)) {
//tel url received
}
if(!([notification rangeOfString:@"mailto"].location==NSNotFound)) {
//email url received
}
else{
//app deep link
}
}