【发布时间】:2015-12-29 21:06:56
【问题描述】:
如果 iPhone 上没有安装应用程序,我想打开 Appstore。例如。我想从我的应用程序中打开 facebook。我就是这样做的
UIApplication *ourApplication = [UIApplication sharedApplication];
NSString *ourPath = @"fb://profile/1234";
NSURL *ourURL = [NSURL URLWithString:ourPath];
[ourApplication openURL:ourURL];
但是如果设备上没有安装 facebook 应用程序,我会收到这样的错误:
LaunchServices: ERROR: There is no registered handler for URL scheme fb
在这种情况下,我想将用户带到 AppStore 上的 facebook 应用程序。我知道我可以这样做:
NSString *stringURL = @"http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=294409923&mt=8";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];
但我怎么知道 Facebook AppStore id 是什么?
【问题讨论】: