这是我从我的应用程序打开facebook链接的代码:
// Check to make sure user has Facebook app installed
if ( [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:mobileUrl]]){
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:mobileUrl]];
NSLog(@"Mobile %@",mobileUrl);
}
// If not, open it in browser
else{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:challenge[@"actionUrl"]]];
NSLog(@"Web %@",challenge[@"actionUrl"]);
}
我有两种情况的有效链接。
网站链接:https://www.facebook.com/gqbeerpb/posts/1431080253818425
应用链接:fb:// post / 1431079887151795_1431080253818425
但是每当我尝试使用本机应用程序打开任何链接时,我都会在时间轴上结束。 当我在应用程序中注释掉打开它的代码,然后在safari中打开它时,我会被导航到正确的页面。