Reputation: 21
I have a react native application that reads a QR code that calls a deeplink (https://reactnavigation.org/docs/deep-linking/) that should show options to open an app or the website, it works fine on Android, but the same doesn't works on iOS, it shows the website but not the app even with it installed.
I set the RCTLinking on AppDelegate.m, set the url types on InfoPlist as well:
The QR code is based on the link https://formulario.153cidadao.com.br/assedio?cidade=2
AppDelegate:
// Linking API
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options: (NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
return [super application:application openURL:url options:options] || [RCTLinkingManager application:application openURL:url options:options];
}
// Universal Links
- (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity restorationHandler:(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler {
BOOL result = [RCTLinkingManager application:application continueUserActivity:userActivity restorationHandler:restorationHandler];
return [super application:application continueUserActivity:userActivity restorationHandler:restorationHandler] || result;
}
InfoPlist:
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>https://formulario.153cidadao.com.br/assedio?cidade=2</string>
<key>CFBundleURLSchemes</key>
<array>
<string>https</string>
</array>
</dict>
</array>
Have you guys found something similar or know if there is something missing? I'm reading the documentation, but didn't found any info regarding this issue.
Upvotes: 1
Views: 840
Reputation: 21
For those wondering how to solve this type of issue, I found some blurry details on docs then I started a new project on XCode and tested myself on how it works and how to set it.
Regarding deep link for React Native on ios, it is only necessary to insert data on AppDelegate if you need the deep link to open a specific screen, if not, only setting on XCode the URL schemes is enough to open the app url Schemes.
If you use universal links and have already set on the backend, and if you need to only open the app, you just need to insert the domain on XCode. domain
In my case, the associated domain was something like:
applinks:formulario.153cidadao.com.br
Best regards, happy new year and happy coding.
Upvotes: 1