Yes, you need to implement application:handleOpenURL: or
application:openURL:sourceApplication:annotation:, and return YES. The second method is preferred according to Apple's docs.
-(BOOL) application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation{
return YES;
}
You could additionally check the scheme, source application, or other conditions, and return YES or NO accordingly. If you have several of your apps communicating you can check for the source application or pass data using the annotation.
NSString* myappScheme = @"anindya"; // or even better read it from your plist
-(BOOL) application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation{
return [url.scheme isEqualToString: myappScheme];
}
As far as security is concerned, you don't really do anything else with the URL, so there's no problem. Apple's advice in this regard means if you get a URL from another app, you have to carefully parse it and assume it might be malicious. If you also check the source application you can be sure to only get data from your own apps.
openURL:for further extension and for code transparency. - kelinopenURL:and then inside the method do nothing? - Anindya Sengupta