firebase / firebase-ios-sdk

Firebase SDK for Apple App Development
https://firebase.google.com
Apache License 2.0
5.6k stars 1.47k forks source link

iOS 14 doesn't receive Dynamic Links on first install (No pre-install link matched for this device) #7406

Closed cuicmex closed 2 years ago

cuicmex commented 3 years ago

[REQUIRED] Step 1: Describe your environment

[REQUIRED] Step 2: Describe the problem

When the app is not installed and tap a Dynamic Link, the application:openURL:options method does not receive the dynamic link url

Steps to reproduce:

  1. App not installed previously
  2. Tap Dynamic Link
  3. Device show App Store page for app
  4. From Xcode build and run app
  5. application:openURL:options receive url = "p://google/link/?request_ip_version=IP_V4&match_message=No pre-install link matched for this device"

Relevant Code:

Captura de pantalla 2021-01-29 a las 12 36 43
google-oss-bot commented 3 years ago

I found a few problems with this issue:

eldhosembabu commented 3 years ago

Could you please share the firebase dynamic link used?

cuicmex commented 3 years ago

https://app.shopadvizor.com/monavis

Associated with app in french App Store

eldhosembabu commented 3 years ago

Could you please try to reproduce this issue in the quick start app?

https://github.com/firebase/quickstart-ios/tree/master/dynamiclinks

ferhatabd commented 3 years ago

Hello,

Sorry for intervening :) but are there any updates on this? thanks

cuicmex commented 3 years ago

ENVIRONMENT

Xcode version: 12.4 iOS version: 14.4 App: quickstart-ios (https://github.com/firebase/quickstart-ios/tree/master/dynamiclinks)

REPRODUCING ISSUE ON quickstart-ios

  1. Download quickstart-ios
  2. Based on the values ​​and configuration files of the original project, configure Dynamic links according to https://firebase.google.com/docs/dynamic-links/ios/receive#objective-c_2
  3. Run diagnostic [FIRDynamicLinks performDiagnosticsWithCompletion:nil]; with output:

---- Firebase Dynamic Links diagnostic output start ---- Firebase Dynamic Links framework version 7.4.0 System information: OS iOS, OS version 14.4, model iPhone Current date 2021-03-02 17:59:45 +0000 Device locale en-ES (raw en_ES), timezone Europe/Madrid Specified custom URL scheme is com.XXXX.YYYY and Info.plist contains such scheme in CFBundleURLTypes key. AppID Prefix: WWWWWWW, Team ID: WWWWWWW, AppId Prefix equal to Team ID: YES performDiagnostic completed successfully! No errors found. ---- Firebase Dynamic Links diagnostic output end ----

  1. App not installed previously
  2. Tap dynamic link
  3. From Xcode build and run quickstart-ios
  4. In method application:openURL:options receive url = "com.XXXX.YYYY://google/link/?request_ip_version=IP%5FV4&match_message=No%20pre%2Dinstall%20link%20matched%20for%20this%20device%2E"
  5. FIRDynamicLink created according to that url, delivers the values ​​shown in the attached image
  6. The test was done with both true and false values ​​for FirebaseDeepLinkPasteboardRetrievalEnabled
Captura de pantalla 2021-03-02 a las 19 20 36
mvpscottjon commented 3 years ago

I have same problem, In first open situation when I set no previewPage, and install from appstore, then app get the url like :

{bundle id}://google/link/?request_ip_version=IP_V4&match_message=No pre-install link matched for this device.

it doesn't work. ==> After that, I use dynamcLink(customScheme:) to handle it , return nil

BUT If I open previewPage when first open from tapping dynamicLink (and user must check for Save my place in the app. A link will be copied to continure to the page)

77111249-3ae88b80-69e4-11ea-9097-c833d852a5c0

I'll receive the url what I want , like :

{bundle id}://google/link/?deep_link_id={THE LINK WHAT I WANT}&match_type=unique&utm_medium=dynamic_link&request_ip_version=IP_V4&utm_source=firebase&match_message=Link is uniquely matched for this device.

it works. ==> After that, I use dynamcLink(customScheme:) to handle it , return correct url.

this is diagnostic below:

---- Firebase Dynamic Links diagnostic output start ---- Firebase Dynamic Links framework version 7.7.0 System information: OS iOS, OS version 14.3, model iPhone Current date 2021-03-10 04:24:03 +0000 Device locale zh-TW (raw zh_TW), timezone Asia/Taipei Specified custom URL scheme is ------------- and Info.plist contains such scheme in CFBundleURLTypes key. AppID Prefix: ------------, Team ID: ------------, AppId Prefix equal to Team ID: YES performDiagnostic completed successfully! No errors found. ---- Firebase Dynamic Links diagnostic output end ----

iOS version : 14 up

LeonXiaoZ commented 3 years ago

Any updates on this issue?

beeirl commented 3 years ago

Same issue here if isForcedRedirectEnabled=true. Any updates? @cuicmex, @mvpscottjon did u find a solution for this?

pradeep-spikey-tech commented 3 years ago

Hi. I'm facing the same issue. Any update?

DimaiOS-coder commented 3 years ago

Only first start app I have url "com.my-project://google/link/?request_ip_version=IP%5FV4&match_message=No%20pre%2Dinstall%20link%20matched%20for%20this%20device%2E " isForcedRedirectEnabled=true and isForcedRedirectEnabled=false don't help. iOS 14+. I understand this because of Apple's restrictions on collecting user information. If there are developers of the library, let me know if any work is being done in this direction?

DimaiOS-coder commented 3 years ago

I create the url manually

misterwell commented 3 years ago

FWIW, I did some debugging and here's the rough sequence of events I saw that seems to only occur on first install of an application using the library. I'm running a slightly older version of the framework but I checked the latest and didn't see any changes that would seem to have an impact on this.

  1. App launches and initiates [FIRApp configure]
  2. Eventually as a part of that configure process, -[FIRDLDefaultRetrievalProcessV2 retrievePendingDynamicLink] is called, which then initiates -[FIRDLDefaultRetrievalProcessV2 fetchLocaleFromWebView] due to_localeFromWebView` property not being set to anything yet.
  3. Fetching the locale seems to execute a FIRDLJavaScriptExecutor to run some Javascript to get the device's locale (I'm sure there's historical context I'm unaware of, but not sure why the iOS SDK's locale APIs couldn't be used for this)
  4. The executor finishes, and ultimately results in -[FIRDLDefaultRetrievalProcessV2 retrievePendingDynamicLinkInternal] being called, which eventually makes a call to [_networkingService retrievePendingDynamicLinkWithIOSVersion...] (truncated for brevity)
  5. Ultimately, all of this ends up calling [FIRDynamicLinks passRetrievedDynamicLinkToApplication:] which triggers whatever deeplink logic you've got in your application.

In our case, we have a property that stores the last received deeplink in case our app isn't yet initialized (as all this happens VERY quickly after the AppDelegate initializes, so we may not have a fully-initialized ViewController stack to work with yet), and in the case where a valid deeplink was clicked that resulted in the app being launched for the first time, this basically causes a race condition where sometimes this "phantom" empty fingerprinting deeplink comes first, and sometimes the originally clicked deeplink comes first... and whichever one comes second was overwriting the first in our case.

We had to add logic to discard any deeplinks that didn't contain any meaningful URL and that allowed us to work around the issue, but it took us a while to chase it down.

Here's the stack trace I saw when putting a breakpoint in my AppDelegate's application:openURL:options: handler:

Thread 1 Queue : com.apple.main-thread (serial)
#0  0x0000000102b2eb08 in <my ApplicationDelegate canOpen handler>
#1  0x0000000103e19f9c in -[GULAppDelegateSwizzler application:openURL:options:] at <rootProjectDir>/Pods/GoogleUtilities/GoogleUtilities/AppDelegateSwizzler/GULAppDelegateSwizzler.m:716
#2  0x00000001039d4f10 in -[FIRDynamicLinks passRetrievedDynamicLinkToApplication:] at <rootProjectDir>/Pods/FirebaseDynamicLinks/FirebaseDynamicLinks/Sources/FIRDynamicLinks.m:537
#3  0x00000001039d51a8 in -[FIRDynamicLinks retrievalProcess:completedWithResult:] at <rootProjectDir>/Pods/FirebaseDynamicLinks/FirebaseDynamicLinks/Sources/FIRDynamicLinks.m:574
#4  0x00000001039cc0dc in -[FIRDLDefaultRetrievalProcessV2 handleRetrievalProcessWithResult:] at <rootProjectDir>/Pods/FirebaseDynamicLinks/FirebaseDynamicLinks/Sources/FIRDLDefaultRetrievalProcessV2.m:172
#5  0x00000001039cbed4 in __68-[FIRDLDefaultRetrievalProcessV2 retrievePendingDynamicLinkInternal]_block_invoke at <rootProjectDir>/Pods/FirebaseDynamicLinks/FirebaseDynamicLinks/Sources/FIRDLDefaultRetrievalProcessV2.m:133
#6  0x00000001039d1c98 in __105-[FIRDynamicLinkNetworking sendRequestWithBaseURLString:requestBody:endpointPath:parserBlock:completion:]_block_invoke_3 at <rootProjectDir>/Pods/FirebaseDynamicLinks/FirebaseDynamicLinks/Sources/FIRDynamicLinkNetworking.m:329

Not sure if this will help anyone, but figured I'd share what I know in case it does.

AurelianTimu commented 3 years ago

I have the same issue if isForcedRedirectEnabled=true. Any updates?

mvpscottjon commented 3 years ago

"isForcedRedirectEnabled" need to set false

But nowadays, when you open on facebook in-app browser, it doesn't work again.....

nekokiller2021 commented 3 years ago

We have the same issue with Firebase Unity SDK v8.1.0 ( Cannot receive dynamic links on first install ) Anybody can hellp ??

andrezanna commented 3 years ago

This also happens to me with flutter2 with firebase_dynamic_links enabled

artalejo commented 3 years ago

Any update on this? I have the same issue when using a custom domain and trying to open it in iPads.

eldhosembabu commented 2 years ago

Hi @cuicmex ,

Sorry for the delayed response. Could you please share the quick start app where you were able to reproduce the issue as I was not able to reproduce this issue on my end.

google-oss-bot commented 2 years ago

Hey @cuicmex. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

google-oss-bot commented 2 years ago

Since there haven't been any recent updates here, I am going to close this issue.

@cuicmex if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.