There are two things you need to do. First, check to see if TestFlight is installed. Then create a new link to your app.
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];
}
This special https://beta.itunes.apple.com
URL will be opened directly in TestFlight.
Finally, if you are using iOS 9 (or later), you need to make an addition to your Info.plist to get the canOpenURL:
method to work.
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>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…