user9261559
user9261559

Reputation: 35

Deep Link in iOS

I got a link from another developer , my requirement is to open the app if that is already installed otherwise redirect to the app store. But its always redirecting me to the app store. It does not open already installed app. Can you guys please tell me how can i fix it and do i need to add something in my info.plist to call deep link . I am sharing code here suggest what should i have to do . enter image description here

Upvotes: 1

Views: 1755

Answers (2)

Milan Nosáľ
Milan Nosáľ

Reputation: 19737

It seems that you are trying to open another app from your own app - I believe what you are doing is correct way to handle it. If the link does not work properly, it leads me to believe that the other app does not support deep linking correctly. In that case you need to contact the other developer and tell him to fix it.

To confirm this, you can try to open that link in safari on your device and it should redirect you to the app if it is configured correctly. If it does not redirect you there from the safari app, then it means that the other developer has some work to do.

Upvotes: 1

Shehata Gamal
Shehata Gamal

Reputation: 100503

You must add the url that you check in your code in the plist of the app you want to open

Suppose you want to open App2 from App1

then add this to plist of App2

  <key>CFBundleURLTypes</key>
 <array>
<dict>
    <key>CFBundleURLName</key>
    <string>com.TestApp</string>
    <key>CFBundleURLSchemes</key>
    <array>
        <string>testApp.linking</string>
    </array>
</dict>

in App1 check

 if(![[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"testApp.linking://?"]]){
     UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"App is not available!" message:nil delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
        [alert show];

    }

take note of testApp.linking is same

Upvotes: 1

Related Questions