Intercepting Open URL for iOS

This topic provides steps for intercepting Open URLs sent from Responsys Message Designer. To send the URL or deep link from Responsys campaign designer select Open URL as described in below image.

`open url` linker switch added

Open URL Interception

By default Open URLs sent from Responsys Server are open by SDK with iOS openURL API. With SDK 6.47 or later you can intercepts these URLs and deep links. Follow below steps to intercept the URLs.

[1] Implement the delegate

Deep link intercepting is available with SDK 6.47 SDK or later. To intercept Open URL and deep link sent from Responsys server implement PIODeepLinkDelegate delegate and set your delegate on PushIOManager as mentioned below.

[[PushIOManager sharedInstance] setDeeplinkDelegate:self]; //Do it in Application launch or after configuring SDK

@interface AppDelegate ()<PIODeepLinkDelegate> //Implement Delegate
@end

@implementation AppDelegate

//Implement delegate method
- (BOOL)handleOpenURL:(NSURL *)url {
    NSLog(@"Deep Link URL: %@",[url absoluteString]);
    return YES; //Return `YES` if you want to handle URL else `NO` for SDK default behaviour.
}
				
//Implement delegate        
class AppDelegate: UIResponder, UIApplicationDelegate, , PIODeepLinkDelegate {

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        //Set the deep link delegate.
        PushIOManager.sharedInstance().deeplinkDelegate = self  //Do it in Application launch or after configuring SDK


        ...

        return true
    }

    //Implement delegate method
    func handleOpen(_ url: URL!) -> Bool {
        print(url.absoluteString)

        return true //Return `true` if you want to handle URL, else return `false` for SDK default behavior.
    }

}
				

Return YES from handleOpenURL method if you want to handle the URL, else return NO for SDK default behavior.