-
Notifications
You must be signed in to change notification settings - Fork 4k
🐛 [firebase_dynamic_link] New iOS install doesn't open with dynamic link after install #7546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@badrobot15 |
@darshankawar As per the flowchart here, After switching to app_links package we found that if the app is installed, the link is delivered successfully by the code snippet I posted above Following is the initial code we tried
|
Thanks for the update. Labeling it based on the report and the fact that this is replicable only after deploying prod app on appstore and then trying to install the app. /cc @Salakar |
I have tried implementing with the latest plugin Also tried implementing the workaround given in the related issue using Here's the implementation of the code (I have separate functions for handling terminated and background/foreground redirects in our app Future<void> handleTerminatedStateDynamicLinks(
BuildContext context, FirebaseDynamicLinks dynamicLinkInstance) async {
try {
final Uri? deepLink;
// Terminated app state
/*if (Platform.isIOS) {
AppLinks _appLinks = AppLinks();
deepLink = await _appLinks.getInitialAppLink();
debugPrint("Deeplink URL (iOS terminated): ${deepLink.toString()}");
} else {
final PendingDynamicLinkData? data =
await dynamicLinkInstance.getInitialLink();
deepLink = data?.link;
debugPrint("Deeplink URL (on terminated): ${deepLink.toString()}");
}*/
final PendingDynamicLinkData? data =
await dynamicLinkInstance.getInitialLink();
deepLink = data?.link;
debugPrint("Deeplink URL (on terminated): ${deepLink.toString()}");
if (deepLink != null) {
String? referCode = deepLink.queryParameters['invited_by'];
// Store refer code in hive because user can drop off in b/w signup
if (referCode != null) {
bool flag = await putPersistentData('refer_code', referCode);
if (flag) {
debugPrint("Saved Referral Code to Hive");
CleverTapPlugin.recordEvent('Referral App Open', {});
}
} else {
// store deeplink for redirect
await putPersistentData('deepLink', deepLink.toString());
}
}
return;
} catch (error) {
debugPrint("Dynamic link terminated state error: ${error.toString()}");
sendErrorLog("handleTerminatedStateDynamicLinks: ${error.toString()}");
}
}
Future<void> handleBackgroundForegroundStateDynamicLinks(
BuildContext context, FirebaseDynamicLinks dynamicLinkInstance) async {
/*if (Platform.isIOS) {
final AppLinks _appLinks = AppLinks();
// Foreground or background app state [iOS]
_appLinks.uriLinkStream.listen((uri) async {
debugPrint('iOS onAppLink: $uri');
PendingDynamicLinkData? deepLink =
await dynamicLinkInstance.getDynamicLink(uri);
handleDynamicLinksRedirects(context, deepLink?.link);
});
} else {*/
// Foreground or background app state [ANDROID]
dynamicLinkInstance.onLink.listen((dynamicLinkData) async {
final Uri deepLink = dynamicLinkData.link;
debugPrint(
"Deeplink URL (on foreground/background): ${deepLink.toString()}");
handleDynamicLinksRedirects(context, deepLink);
return;
}).onError((error) {
// Handle errors
debugPrint(
"Dynamic Link error at foreground/background Listener: ${error.toString()}");
sendErrorLog(
"handleBackgroundForegroundStateDynamicLinks: ${error.toString()}");
});
//}
return;
}
|
This comment was marked as outdated.
This comment was marked as outdated.
@darshankawar As discussed in #9103 (comment) I'm posting my question here. This is the exact issue I am facing. I have already tried the workaround using the app_links plugin but it didn't solve the issue. Though I have only tested through TestFlight using the iosFallbackLink (pointing to the TestFlight app). Can you confirm testing dynamic links through TestFlight using the iosFallbackLink parameter should work? |
@darshankawar Any update on this issue? |
@darshankawar A response would be much appreciated. I have not heard back from you since you closed my original issue. |
@wederchr Sorry for not coming back to this earlier. Please take a look at below links and see if they help: |
/cc @russellwheatley |
Thank you for your response, I'll take a look! Did you also have time to clarify my question regarding firebase dynamic link testing using TestFlight? |
The flutter firebase dynamic links plugin seems to work now without any other package. There was an issue with some native code being override for supporting an attribution SDK in my case. Removing that helped making firebase dynamic link plugin work on both iOS and android in all 3 app state. |
Having the same issue. getInitialLink() always null and onLink method seems not called on ios. I also tried app_link package and it always return null. |
It looks like @darshankawar and @russellwheatley don't care anymore because they keep promising to look into it and then nothing happens for weeks and bots try to either tag it or close it. It is a pity because even though branch.io offers a working alternative I'd prefer to use Firebase because my app has been already having too many dependencies... |
I think using
This isn't true. We care for each and every issue that is filed. The team comes back to issues when they have completed the task at their hand. I will also forward this issue for team's attention. |
@darshankawar Thanks! |
hi.. this issue is unfortunately bugging us too.. hope this can be fixed soon... |
I'm going to be looking at dynamic links soon. I've been working on major SDK updates and latest count API for Firestore. |
Thanks for looking at it @russellwheatley. It's becoming a hinderance for our company. |
Same issue happening for us too. I have used the
|
I tried using the Dynamic Links example as @russellwheatley suggests in this comment. But since I don't have access to the Provisioning Profile I can't test it. I have copied and pasted the code to another project where I have configured Firebase following the Firebase Dynamic Links documentation. This is what I get RPReplay_Final1668287401.MP4 |
I am facing the same issue. Has anyone found a solution? I had this working about a year ago. So either ios or this package changed. |
In case anyone still needs a solution, here's what worked for me.
And this block after @implementation AppDelegate
and I added this line after '[FIRApp configure];'
|
We have been struggling with the same issue for weeks an non of the solutions above worked for us. Moreover, both the flutter library for Firebase Dynamic Links and the example, are written in Objective-C and our flutter app is written on Swift.
|
I also have the same problem, when starting the application from the appstore through a dynamic link, the popup appears that the data has been copied, but once it is started through "getInitialLink" they all appear in null link example: |
This comment provides a solution that worked for me. All I had to do is setup my
@russellwheatley I think the documentation should be updated to demonstrate this. |
@bcgreijnlautier thank you! this solution worked for me too. |
@bcgreijnlautier that is a good idea. I will do that 👍 |
I'm so confused @russellwheatley you say here:
that you should first set up the stream as @bcgreijnlautier mentions
But then on the documentation, you state the opposite, I'm just confused. (From the commit 915a75d) PR: #10493 Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(options: DefaultFirebaseConfig.platformOptions);
// Get any initial links
// Check if you received the link via `getInitialLink` first
final PendingDynamicLinkData? initialLink = await FirebaseDynamicLinks.instance.getInitialLink();
if (initialLink != null) {
final Uri deepLink = initialLink.link;
// Example of using the dynamic link to push the user to a different screen
Navigator.pushNamed(context, deepLink.path);
}
FirebaseDynamicLinks.instance.onLink.listen(
(pendingDynamicLinkData) {
// Set up the `onLink` event listener next as it may be received here
if (pendingDynamicLinkData != null) {
final Uri deepLink = pendingDynamicLinkData.link;
// Example of using the dynamic link to push the user to a different screen
Navigator.pushNamed(context, deepLink.path);
}
},
);
runApp(MyApp(initialLink));
} |
@migalv both are fine. The point is, on iOS, the initial link could be received by either |
Same issue. Everything works perfect on Android. But, after download from App Store, it does not works on inital opening on iOS. However, when I clicked the dynamic link when app is open on the background, it works. Any update about this issue? My configurations of Firebase related packages and code are below: Packages:
|
Make sure you have GoogleService-Info.plist included in your iOS project. Old versions of flutterfire_cli did not generate this file. You may have to run flutterfire_cli again to do so. |
I have GoogleService-Info.plist. If I had problem related GoogleService-Info.plist, probably does not work also other Firebase/Firestore services. All of them works without problem currently. |
Uh oh!
There was an error while loading. Please reload this page.
Bug report
Dynamic Link returns null
On latest version of 4.0.2, for fresh app installs from a dynamic link in iOS via AppStore, the link isn't received in Flutter App. On clicking the link, the app store page opens as required, but after the user downloads the app, the dynamic link within the app seems to be null. Now if having the app already installed on the phone, on clicking the link, the app successfully gets the link. While this behavior is fine for users who already have the app, it totally ruins the experience for new users.
Additional context
Found a similar problem at issue #1861 but that seems to have been closed with the only solution being restart the phone and then install. Since the only way we are able to reproduce the bug is after deploying it to production on app store, it is quite difficult to debug and find the problem.
As per #6913 I had to use AppLinks to get the link for iOS only.
The text was updated successfully, but these errors were encountered: