ios - 从另一个应用程序打开 TestFlight 应用程序并深层链接到特定应用程序

标签 ios objective-c iphone deep-linking

我如何从我自己的 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/

相关文章:

android - 如何为 iOS 和 Android 移动应用程序创建 REST 身份验证

iOS:如何从功能 "isEqual"的钥匙串(keychain)中获取用户名/密码?

iphone - 如何在 iOS 中制作水平可滚动的 UITabBar?

iphone - 如何在 Objective-C 中的另一个方法中调用一个方法

ios - 在 iOS 8.1 模拟器上更改语言不起作用

ios - Swift - 转换为绝对值

ios - 如何使用 AFNetworking 2.x 管理许多(>500)后台 URLSession 下载?

objective-c - 不理解 Objective-C 中的这种语法

ios - 如何获得两个 NSStrings 的百分比差异

iphone - iPhone 模拟器的屏幕截图应用程序