How to handle UIApplication handleOpenURL with multiple URL's

 ̄綄美尐妖づ 提交于 2019-11-29 22:23:41

Facebook and Instagram both had you setup a custom URL scheme for their services, so we will use that to filter the URL.

-(BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {

    if ([[url scheme] isEqualToString:INSTAGRAM_SCHEME])
        return [self.instagram handleOpenURL:url];

    if ([[url scheme] isEqualToString:FACEBOOK_SCHEME])
        return [PFFacebookUtils handleOpenURL:url];

    return NO;

}

Where you define your variables as

#define INSTAGRAM_SCHEME @"ig12345678910"
#define FACEBOOK_SCHEME  @"fb12345678910"

exactly as you did in your Info.plist file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!