我如何从我自己的 iOS 应用程序中找到另一个应用程序的方案并深层链接到它?
更具体地说,我想在某些条件下(由我的代码设置)深层链接到 Testflight 应用程序。我假设此人已安装 Testflight(这可能是一个错误的假设,但我们可以接受该假设)。
我知道在 Android 上,您可以查询应用并发送意图以深层链接到其他人的应用。 iOS 上的等效项是什么?
最佳答案
您需要做两件事。首先,检查是否安装了 TestFlight。然后创建指向您的应用的新链接。
NSURL *customAppURL = [NSURL URLWithString:@"itms-beta://"];
if ([[UIApplication sharedApplication] canOpenURL:customAppURL]) {
// TestFlight is installed
// Special link that includes the app's Apple ID
customAppURL = [NSURL URLWithString:@"https://beta.itunes.apple.com/v1/app/978489855"];
[[UIApplication sharedApplication] openURL:customAppURL];
}
这个特殊的 https://beta.itunes.apple.com
URL 将直接在 TestFlight 中打开。
最后,如果您使用的是 iOS 9(或更高版本),则需要添加到您的 Info.plist 以使 canOpenURL:
方法起作用。
If your app is linked on or after iOS 9.0, you must declare the URL schemes you want to pass to this method. Do this by using the LSApplicationQueriesSchemes array in your Xcode project’s Info.plist file. For each URL scheme you want your app to use with this method, add it as a string in this array.
<key>LSApplicationQueriesSchemes</key>
<array>
<string>itms-beta</string>
</array>
关于ios - 从另一个应用程序打开 TestFlight 应用程序并深层链接到特定应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26667467/