Hi guys,
I want to ask. The URL receive by .getInitialLink()
and .onLink()
is different when the dynamic link URL is typed and click.
1st case:
2nd case:
I want to try to click the link instead of typing it
Can anybody help me how to fix this problem ?
Application Target Platform: iOS
Development Operating System: macOS High Sierra
Build Tools: VS Code
React Native
version: 0.47.2
React Native Firebase
Version: 3.2
Firebase
Module: Dynamic Link
Are you using typescript
? No
@kevindavee could you please let me what's your following configuration, because i can not get it working ( when click on safari doesn't open on neither simulator nor real device )
if your bundle is : com.example.appName
And Dynamic Links domain in firebase console is appName.page.link
info
tab -> URL Types ?[FIROptions defaultOptions].deepLinkURLScheme = ...
in AppDelegate.m` File ?I have detached from expo and started integrating this library, but its about 2, 3 weeks im struggling with this issue and some more
Thanks.
Hi @FakhruddinAbdi , sorry for late reply
https://yummybox.page.link
AppDelegate.m
[FIROptions defaultOptions].deepLinkURLScheme = @"https://yummybox.page.link";
applinks:yummybox.page.link
The main issues is iOS have 2 mechanism to handle deep links, with URL scheme dan UniversalLink. Case number 2 is using Universal Link because iMessage supports it. But the URL i received in the app, either with .onLink()
or with .getInitialLink()
is the short URL. But if the deep link is opened with app that is not supporting Universal Link, iOS will use URL scheme, and it receives the long URL which contains the parameters that required to navigate the app to the content.
Hi @kevindavee
Thank you very much for your detailed answer.
This part helped me [FIROptions defaultOptions].deepLinkURLScheme = @"https://yummybox.page.link";
It not well documented , Im going to send a PR
Just one more thing @kevindavee sorry
The dynamic link now open the app, but neither onLink
nor getInitialLink
, addEventListener('url'
doesn't trigger if the app already running.
Just getInitialLink
get triggred if we open the app with dynamic link
Do you have solution for it ?
@FakhruddinAbdi I'm facing similar issue.
Using
"react-native-firebase": "^4.1.0"
"react-native": "0.55.4"
We're you able to figure out the solution?
I just missed some functions mentioned in the doc to be added to AppDelegate.m
When i fixed them, it start workgin @surendharreddy
@FakhruddinAbdi can you share those functions or point me to the right place to learn about them?
Here's what I added to my AppDelegate.m
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
options:(NSDictionary<NSString *, id> *)options {
return [[RNFirebaseLinks instance] application:application openURL:url options:options];
}
- (BOOL)application:(UIApplication *)application
continueUserActivity:(NSUserActivity *)userActivity
restorationHandler:(void (^)(NSArray *))restorationHandler {
return [[RNFirebaseLinks instance] application:application continueUserActivity:userActivity restorationHandler:restorationHandler];
}
#import "RNFirebaseNotifications.h"
#import "RNFirebaseMessaging.h"
#import "RNFirebaseLinks.h"
#import <React/RCTLinkingManager.h>
#import <React/RCTBundleURLProvider.h>
#import <Firebase.h>
#import "AppDelegate.h"
#import "ExpoKit.h"
#import "EXViewController.h"
@interface AppDelegate ()
@property (nonatomic, strong) EXViewController *rootViewController;
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[FIROptions defaultOptions].deepLinkURLScheme = @"https://app.page.link";
[FIRApp configure];
[RNFirebaseNotifications configure];
[application registerForRemoteNotifications];
_window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
_window.backgroundColor = [UIColor whiteColor];
[[ExpoKit sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions];
_rootViewController = [ExpoKit sharedInstance].rootViewController;
_window.rootViewController = _rootViewController;
[_window makeKeyAndVisible];
return YES;
}
#pragma mark - Handling URLs
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
return [RCTLinkingManager application:application openURL:url options:options];
}
- (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity restorationHandler:(nonnull void (^)(NSArray * _Nullable))restorationHandler
{
return [[ExpoKit sharedInstance] application:application continueUserActivity:userActivity restorationHandler:restorationHandler];
}
#pragma mark - Notifications
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
[[RNFirebaseNotifications instance] didReceiveLocalNotification:notification];
}
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(nonnull NSDictionary *)userInfo
fetchCompletionHandler:(nonnull void (^)(UIBackgroundFetchResult))completionHandler{
[[RNFirebaseNotifications instance] didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
}
- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings {
[[RNFirebaseMessaging instance] didRegisterUserNotificationSettings:notificationSettings];
}
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)token
{
[[ExpoKit sharedInstance] application:application didRegisterForRemoteNotificationsWithDeviceToken:token];
}
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)err
{
[[ExpoKit sharedInstance] application:application didFailToRegisterForRemoteNotificationsWithError:err];
}
@end
This is my appdelegate.m file .. FYI i detached from expo
Hi, @kevindavee @FakhruddinAbdi
you should not set
[FIROptions defaultOptions].deepLinkURLScheme = @"https://app.page.link";
you should set deepLinkURLScheme as your bundle id,
base on your case, the correct setting should be :
[FIROptions defaultOptions].deepLinkURLScheme = @"com.example.appName";
also go to Xcode -> Targets -> URL types -> set a new url type
identifier: Bundle ID(or any unique value)
URL Schemes: com.example.appName(you bundle id)
Got it working by following this guide https://facebook.github.io/react-native/docs/linking#handling-deep-links
Hello 馃憢, this issue has been automatically marked as stale because it has not had activity for quite some time. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. Thank you for your contributions.
Closing this issue after a prolonged period of inactivity. If this is still present in the latest release, please feel free to create a new issue with up-to-date information.
Hello - is this something that was ever fixed? I successfully integrated dynamic links - the app opens, I receive the resolved URL from onLink
however the URL does not include any of the query parameters that are present on the dynamic link.
@mtford90 same here, can not get any param. do u find any solution for this ?
created a dynamic link by API not by Firebase console and add isi into the link solved my problem
@thanh90 do you have a complete example of the code (or links) you have working now? It could help a lot of people in the future - this is a difficult thing for people to get working, based on issue counts. Thanks!
const link =
new firebase.links.DynamicLink("https://xxx.com/foo/bar/", "https://xxx.page.link")
.android.setPackageName("com.xxx.android")
.ios.setBundleId("com.xxx.ios")
.ios.setAppStoreId("144xxxx310");
firebase.links()
.createDynamicLink(link)
.then((url) => {
console.log('generated dynamic link', decodeURIComponent(url));
Linking.openURL(decodeURIComponent(url));
}).catch(err => console.log(err));
You have to create a URL prefix 'https://xxx.page.link' on Firebase Console
fantastic, thank you!
Most helpful comment
Hi @FakhruddinAbdi , sorry for late reply
https://yummybox.page.link
AppDelegate.m
applinks:yummybox.page.link
The main issues is iOS have 2 mechanism to handle deep links, with URL scheme dan UniversalLink. Case number 2 is using Universal Link because iMessage supports it. But the URL i received in the app, either with
.onLink()
or with.getInitialLink()
is the short URL. But if the deep link is opened with app that is not supporting Universal Link, iOS will use URL scheme, and it receives the long URL which contains the parameters that required to navigate the app to the content.