修改文件AppDelegate+IonicDeeplink.m的openURL方法,内容改成下面的:
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
BOOL handled = NO;
if ([[url absoluteString] rangeOfString:@"liepiao"].location == 0) {
IonicDeeplinkPlugin *plugin = [self.viewController getCommandInstance:PLUGIN_NAME];
if(plugin == nil) {
NSLog(@"Unable to get instance of command plugin");
}
handled = [plugin handleLink:url];
}
if(!handled) {
// Pass event through to Cordova
[[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPluginHandleOpenURLNotification object:url]];
// Send notice to the rest of our plugin that we didn't handle this URL
[[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:@"IonicLinksUnhandledURL" object:[url absoluteString]]];
}
return YES;
}