Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
675 views
in Technique[技术] by (71.8m points)

ios - Opening TestFlight app from another app and deep link to specific app

How do i find the scheme of another app and deep link to it from my own iOS app?

More specifically, I want to deep link to the Testflight app upon certain conditions (set by my code). I'm assuming the person has Testflight installed, (which might be a bad assumption but we can live with that assumption).

I know that on Android, you can query for apps and send intents to deep link to someone else's app. What would be the equivalent on iOS?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...