问题
Could anybody help me out please? iOS Branch deep link does not open application on device, but works well on simulator. My simulator OS version is 10.3, my iPhone 5s OS version is 10.3.3
What I have done:
Dashboard: Settings -> Link Settings:
- "Always try to open app" is checked
- "IOS URI Scheme" is set to the application's custom URI scheme.
- "Enable Universal Links" is checked.
- Bundle Identifier & Apple App Prefix are both set correctly.
Link Domain was set as bellow:
Test Link was created as bellow:
Xcode Configuration:
1.Associated Domains
2.Info.plist file
And, code as bellow:
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation {
[[Branch getInstance] handleDeepLink:url];
BOOL success = NO;
success = [[FBSDKApplicationDelegate sharedInstance] application:application
openURL:url
sourceApplication:sourceApplication
annotation:annotation];
if (!success) {
success = [router handleURL:url withCompletion:nil];
}
//force return YES
return YES;
}
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *))restorationHandler {
BOOL ret = NO;
ret = [[Branch getInstance] continueUserActivity:userActivity];
if (!ret) {
ret = [router handleUserActivity:userActivity withCompletion:NULL];
}
//force return YES
return YES;
}
What I tested:
I sent the Test Deep Link to my email, and I open the email through Safari. While I click the url on DEVICE, an alert was shown to tell me App Store will be open. While I click the url on SIMULATOR, my app was open successfully.
I pasted the Test Deep Link into Notes on DEVICE, while I click the url, an action sheet was shown and provide two option: open in Safari, Open in xxx(my app name). I click both options, they all could open my app successfully.
Here is all the configuration, code, steps, and I have also tried to change branch_app_domain to applinks:xxxapp.app.link, it didn't work neither.
Is there anything that I missed during the integration procedure? Any suggestion would be very appreciate. Thanks in advance!
Roby
回答1:
Amruta from Branch.io here:
I tested with your App available on the App Store and Universal links work as expected. I shared the link via Slack, the default Email App on iOS as well as the Gmail app. On all three platforms clicking on the Branch link for your App opened your App via Universal links as expected.
Based on your description of testing it looks like you are disabling Universal links (clicking the breadcrumb on the top right link disables Universal links.
To re-enable Universal Links for an app: 1. Paste one of your Branch links into a new note 2. Perform a long press on the link (note: if you see a "preview" window pop open, you are pressing too hard)
Note that this is a 'per-device' issue, so if you accidentally disable Universal Links on one phone, it won't affect other users.
Unfortunately, there is no way to ensure that a user does not disable Universal links by mistake. However, there is a silver lining, this will no longer be an issue post iOS 11. With iOS 11 the breadcrumb in the top right corner has disappeared and so has the ability to disable Universal Links.
来源:https://stackoverflow.com/questions/45930696/ios-branch-deep-link-does-not-open-application-on-device-but-works-well-on-simu