firebase / flutterfire

🔥 A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.71k stars 3.97k forks source link

🐛 [firebase_dynamic_links] FirebaseDynamicLinks.instance.getInitialLink() returns Null in iOS #11484

Closed juanleondev closed 1 year ago

juanleondev commented 1 year ago

Bug report

Describe the bug When I open a dynamic link with the app in state terminated, the method getInitialLink() returns null.

Steps to reproduce

Steps to reproduce the behavior:

  1. Create a dynamic link in the Firebase console without a custom domain.
  2. Install the app on iOS and kill it.
  3. Open the dynamic link in the notes app.
  4. The app will show the main page.

Expected behavior

I expect to open the app on the page I set in the dynamic link.


Additional context


Flutter doctor

Run flutter doctor and paste the output below:

Click To Expand ``` [✓] Flutter (Channel stable, 3.10.6, on macOS 13.3.1 22E772610a darwin-arm64, locale en-PE) [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2) [✓] Xcode - develop for iOS and macOS (Xcode 14.3) [✓] Chrome - develop for the web [✓] Android Studio (version 2022.2) [✓] VS Code (version 1.81.0) [✓] Connected device (3 available) [✓] Network resources • No issues found! ```

Flutter dependencies

Run flutter pub deps -- --style=compact and paste the output below:

Click To Expand ``` Dart SDK 3.0.6 Flutter SDK 3.10.6 craftedpour 2.1.51+96 dependencies: - algolia_api_client 0.0.1 [equatable http json_serializable] - analytics_repository 0.0.0 [equatable firebase_analytics flutter] - authentication_repository 0.0.1 [cloud_functions crypto equatable firebase_auth flutter flutter_facebook_auth google_sign_in sign_in_with_apple] - cached_network_image 3.2.3 [flutter flutter_cache_manager octo_image cached_network_image_platform_interface cached_network_image_web] - contributor_repository 0.0.1 [algolia_api_client async cloud_firestore data_repository equatable flutter json_annotation json_serializable notifications_repository] - crafted_pour_ui 0.0.1 [flutter flutter_svg] - cupertino_icons 1.0.5 - data_repository 0.0.1 [cloud_firestore equatable json_serializable] - dotted_border 2.0.0+3 [flutter path_drawing] - dynamic_links_service 0.1.0+1 [firebase_dynamic_links] - email_repository 0.0.1 [cloud_firestore equatable flutter json_serializable] - equatable 2.0.5 [collection meta] - event_repository 0.0.1 [async cloud_firestore equatable json_annotation json_serializable] - firebase_core 2.15.0 [firebase_core_platform_interface firebase_core_web flutter meta] - firebase_crashlytics 3.3.3 [firebase_core firebase_core_platform_interface firebase_crashlytics_platform_interface flutter stack_trace] - firebase_dynamic_links 5.3.4 [firebase_core firebase_core_platform_interface firebase_dynamic_links_platform_interface flutter meta plugin_platform_interface] - flutter 0.0.0 [characters collection js material_color_utilities meta vector_math sky_engine] - flutter_bloc 8.1.3 [bloc flutter provider] - flutter_localizations 0.0.0 [flutter intl characters clock collection js material_color_utilities meta path vector_math] - flutter_native_splash 2.2.16 [args flutter flutter_web_plugins js html image meta path universal_io xml yaml] - form_inputs 0.0.0 [formz] - go_router 6.5.9 [collection flutter flutter_web_plugins logging meta] - hydrated_bloc 9.1.2 [bloc hive meta synchronized] - intl 0.18.0 [clock meta path] - media_picker_repository 0.0.1 [cropper_service equatable flutter image_picker] - notifications_repository 0.0.1 [cloud_firestore equatable firebase_messaging flutter json_annotation json_serializable] - path_provider 2.1.0 [flutter path_provider_android path_provider_foundation path_provider_linux path_provider_platform_interface path_provider_windows] - products_repository 0.0.1 [algolia_api_client cloud_firestore equatable flutter json_annotation] - readmore 2.2.0 [flutter] - recipe_repository 0.0.1 [algolia_api_client async cloud_firestore data_repository equatable json_annotation json_serializable sentry] - reports_repository 0.0.1 [cloud_firestore equatable flutter json_annotation] - sentry_flutter 7.8.0 [flutter flutter_web_plugins sentry package_info_plus meta] - share_repository 0.0.1 [flutter share_plus] - storage_repository 0.0.1 [async equatable firebase_storage flutter json_annotation mime_type path] - url_launcher 6.1.11 [flutter url_launcher_android url_launcher_ios url_launcher_linux url_launcher_macos url_launcher_platform_interface url_launcher_web url_launcher_windows] dev dependencies: - flutter_launcher_icons 0.11.0 [args checked_yaml cli_util image json_annotation path yaml] - very_good_analysis 4.0.0+1 transitive dependencies: - _fe_analyzer_shared 62.0.0 [dart_internal meta] - _flutterfire_internals 1.3.4 [collection firebase_core firebase_core_platform_interface flutter meta] - analyzer 6.0.0 [_fe_analyzer_shared collection convert crypto glob meta package_config path pub_semver source_span watcher yaml] - archive 3.3.7 [crypto path pointycastle] - args 2.4.2 - async 2.11.0 [collection meta] - bloc 8.1.2 [meta] - boolean_selector 2.1.1 [source_span string_scanner] - build 2.4.1 [analyzer async convert crypto glob logging meta package_config path] - build_config 1.1.1 [checked_yaml json_annotation path pubspec_parse yaml] - cached_network_image_platform_interface 2.0.0 [flutter flutter_cache_manager] - cached_network_image_web 1.0.2 [flutter flutter_cache_manager cached_network_image_platform_interface] - characters 1.3.0 - checked_yaml 2.0.3 [json_annotation source_span yaml] - cli_util 0.3.5 [meta path] - clock 1.1.1 - cloud_firestore 4.8.2 [cloud_firestore_platform_interface cloud_firestore_web collection firebase_core firebase_core_platform_interface flutter meta] - cloud_firestore_platform_interface 5.15.2 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface] - cloud_firestore_web 3.6.2 [_flutterfire_internals cloud_firestore_platform_interface collection firebase_core firebase_core_web flutter flutter_web_plugins js] - cloud_functions 4.3.3 [cloud_functions_platform_interface cloud_functions_web firebase_core firebase_core_platform_interface flutter] - cloud_functions_platform_interface 5.4.3 [firebase_core flutter meta plugin_platform_interface] - cloud_functions_web 4.5.3 [cloud_functions_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins js] - collection 1.17.1 - convert 3.1.1 [typed_data] - cropper_service 0.0.1 [equatable flutter image_cropper very_good_analysis] - cross_file 0.3.3+4 [js meta] - crypto 3.0.3 [typed_data] - csslib 1.0.0 [source_span] - dart_internal 0.2.8 - dart_style 2.3.2 [analyzer args path pub_semver source_span] - facebook_auth_desktop 0.0.9 [flutter http flutter_secure_storage flutter_facebook_auth_platform_interface] - fake_async 1.3.1 [clock collection] - ffi 2.0.2 - file 6.1.4 [meta path] - file_selector_linux 0.9.2 [cross_file file_selector_platform_interface flutter] - file_selector_macos 0.9.3 [cross_file file_selector_platform_interface flutter] - file_selector_platform_interface 2.6.0 [cross_file flutter http plugin_platform_interface] - file_selector_windows 0.9.3 [cross_file file_selector_platform_interface flutter] - firebase_analytics 10.4.3 [firebase_analytics_platform_interface firebase_analytics_web firebase_core firebase_core_platform_interface flutter] - firebase_analytics_platform_interface 3.6.3 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface] - firebase_analytics_web 0.5.4+3 [_flutterfire_internals firebase_analytics_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins js] - firebase_auth 4.6.3 [firebase_auth_platform_interface firebase_auth_web firebase_core firebase_core_platform_interface flutter meta] - firebase_auth_platform_interface 6.15.3 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface] - firebase_auth_web 5.5.3 [firebase_auth_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins http_parser js meta] - firebase_core_platform_interface 4.8.0 [collection flutter flutter_test meta plugin_platform_interface] - firebase_core_web 2.6.0 [firebase_core_platform_interface flutter flutter_web_plugins js meta] - firebase_crashlytics_platform_interface 3.6.3 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface] - firebase_dynamic_links_platform_interface 0.2.6+4 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface] - firebase_messaging 14.6.4 [firebase_core firebase_core_platform_interface firebase_messaging_platform_interface firebase_messaging_web flutter meta] - firebase_messaging_platform_interface 4.5.3 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface] - firebase_messaging_web 3.5.3 [_flutterfire_internals firebase_core firebase_core_web firebase_messaging_platform_interface flutter flutter_web_plugins js meta] - firebase_storage 11.2.4 [firebase_core firebase_core_platform_interface firebase_storage_platform_interface firebase_storage_web flutter] - firebase_storage_platform_interface 4.4.3 [collection firebase_core flutter meta plugin_platform_interface] - firebase_storage_web 3.6.4 [_flutterfire_internals async firebase_core firebase_core_web firebase_storage_platform_interface flutter flutter_web_plugins http js meta] - flutter_blurhash 0.7.0 [flutter] - flutter_cache_manager 3.3.1 [clock collection file flutter http path path_provider rxdart sqflite uuid] - flutter_facebook_auth 5.0.11 [flutter flutter_facebook_auth_platform_interface flutter_facebook_auth_web facebook_auth_desktop] - flutter_facebook_auth_platform_interface 4.1.1 [flutter plugin_platform_interface] - flutter_facebook_auth_web 4.1.1 [flutter flutter_web_plugins js flutter_facebook_auth_platform_interface] - flutter_plugin_android_lifecycle 2.0.15 [flutter] - flutter_secure_storage 8.0.0 [flutter flutter_secure_storage_linux flutter_secure_storage_macos flutter_secure_storage_platform_interface flutter_secure_storage_web flutter_secure_storage_windows meta] - flutter_secure_storage_linux 1.1.3 [flutter flutter_secure_storage_platform_interface] - flutter_secure_storage_macos 3.0.0 [flutter flutter_secure_storage_platform_interface] - flutter_secure_storage_platform_interface 1.0.1 [flutter plugin_platform_interface] - flutter_secure_storage_web 1.1.1 [flutter flutter_secure_storage_platform_interface flutter_web_plugins js] - flutter_secure_storage_windows 2.0.0 [flutter flutter_secure_storage_platform_interface] - flutter_svg 1.1.6 [flutter meta path_drawing vector_math xml] - flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters collection js matcher material_color_utilities meta source_span stream_channel string_scanner term_glyph] - flutter_web_plugins 0.0.0 [flutter js characters collection material_color_utilities meta vector_math] - formz 0.4.1 - glob 2.1.2 [async collection file path string_scanner] - google_sign_in 5.4.4 [flutter google_sign_in_android google_sign_in_ios google_sign_in_platform_interface google_sign_in_web] - google_sign_in_android 6.1.18 [flutter google_sign_in_platform_interface] - google_sign_in_ios 5.6.2 [flutter google_sign_in_platform_interface] - google_sign_in_platform_interface 2.4.1 [flutter plugin_platform_interface quiver] - google_sign_in_web 0.10.2+1 [flutter flutter_web_plugins google_sign_in_platform_interface js] - hive 2.2.3 [meta crypto] - html 0.15.4 [csslib source_span] - http 0.13.6 [async http_parser meta] - http_parser 4.0.2 [collection source_span string_scanner typed_data] - image 3.3.0 [archive meta xml] - image_cropper 3.0.3 [flutter image_cropper_platform_interface image_cropper_for_web] - image_cropper_for_web 1.0.3 [flutter flutter_web_plugins image_cropper_platform_interface js] - image_cropper_platform_interface 3.0.3 [flutter plugin_platform_interface http] - image_picker 0.8.9 [flutter image_picker_android image_picker_for_web image_picker_ios image_picker_linux image_picker_macos image_picker_platform_interface image_picker_windows] - image_picker_android 0.8.7+3 [flutter flutter_plugin_android_lifecycle image_picker_platform_interface] - image_picker_for_web 2.2.0 [flutter flutter_web_plugins image_picker_platform_interface mime] - image_picker_ios 0.8.8 [flutter image_picker_platform_interface] - image_picker_linux 0.2.1 [file_selector_linux file_selector_platform_interface flutter image_picker_platform_interface] - image_picker_macos 0.2.1 [file_selector_macos file_selector_platform_interface flutter image_picker_platform_interface] - image_picker_platform_interface 2.8.0 [cross_file flutter http plugin_platform_interface] - image_picker_windows 0.2.1 [file_selector_platform_interface file_selector_windows flutter image_picker_platform_interface] - js 0.6.7 [meta] - json_annotation 4.8.1 [meta] - json_serializable 6.7.1 [analyzer async build build_config collection json_annotation meta path pub_semver pubspec_parse source_gen source_helper] - logging 1.2.0 - matcher 0.12.15 [async meta stack_trace term_glyph test_api] - material_color_utilities 0.2.0 - meta 1.9.1 - mime 1.0.4 - mime_type 1.0.0 - nested 1.0.0 [flutter] - octo_image 1.0.2 [flutter flutter_blurhash] - package_config 2.1.0 [path] - package_info_plus 3.1.2 [ffi flutter flutter_web_plugins http meta path package_info_plus_platform_interface win32] - package_info_plus_platform_interface 2.0.1 [flutter meta plugin_platform_interface] - path 1.8.3 - path_drawing 1.0.1 [vector_math meta path_parsing flutter] - path_parsing 1.0.1 [vector_math meta] - path_provider_android 2.1.0 [flutter path_provider_platform_interface] - path_provider_foundation 2.3.0 [flutter path_provider_platform_interface] - path_provider_linux 2.2.0 [ffi flutter path path_provider_platform_interface xdg_directories] - path_provider_platform_interface 2.1.0 [flutter platform plugin_platform_interface] - path_provider_windows 2.2.0 [ffi flutter path path_provider_platform_interface win32] - petitparser 5.4.0 [meta] - platform 3.1.0 - plugin_platform_interface 2.1.4 [meta] - pointycastle 3.7.3 [collection convert js] - process 4.2.4 [file path platform] - provider 6.0.5 [collection flutter nested] - pub_semver 2.1.4 [collection meta] - pubspec_parse 1.2.3 [checked_yaml collection json_annotation pub_semver yaml] - quiver 3.2.1 [matcher] - rxdart 0.27.7 - sentry 7.8.0 [http meta stack_trace uuid] - share_plus 6.3.4 [cross_file meta mime flutter flutter_web_plugins share_plus_platform_interface file url_launcher_web url_launcher_windows url_launcher_linux url_launcher_platform_interface ffi win32] - share_plus_platform_interface 3.2.1 [cross_file flutter meta mime plugin_platform_interface path_provider uuid] - sign_in_with_apple 4.3.0 [flutter meta sign_in_with_apple_platform_interface sign_in_with_apple_web] - sign_in_with_apple_platform_interface 1.0.0 [flutter plugin_platform_interface meta] - sign_in_with_apple_web 1.0.1 [flutter flutter_web_plugins sign_in_with_apple_platform_interface js] - sky_engine 0.0.99 - source_gen 1.4.0 [analyzer async build dart_style glob path source_span yaml] - source_helper 1.3.4 [analyzer collection source_gen] - source_span 1.9.1 [collection path term_glyph] - sqflite 2.2.8+4 [flutter sqflite_common path] - sqflite_common 2.4.5+1 [synchronized path meta] - stack_trace 1.11.0 [path] - stream_channel 2.1.1 [async] - string_scanner 1.2.0 [source_span] - synchronized 3.1.0 - term_glyph 1.2.1 - test_api 0.5.1 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph matcher] - typed_data 1.3.2 [collection] - universal_io 2.2.2 [collection meta typed_data] - url_launcher_android 6.0.36 [flutter url_launcher_platform_interface] - url_launcher_ios 6.1.4 [flutter url_launcher_platform_interface] - url_launcher_linux 3.0.5 [flutter url_launcher_platform_interface] - url_launcher_macos 3.0.5 [flutter url_launcher_platform_interface] - url_launcher_platform_interface 2.1.3 [flutter plugin_platform_interface] - url_launcher_web 2.0.18 [flutter flutter_web_plugins url_launcher_platform_interface] - url_launcher_windows 3.0.6 [flutter url_launcher_platform_interface] - uuid 3.0.7 [crypto] - vector_math 2.1.4 - watcher 1.1.0 [async path] - win32 3.1.4 [ffi] - xdg_directories 1.0.0 [meta path process] - xml 6.3.0 [collection meta petitparser] - yaml 3.1.2 [collection source_span string_scanner] ```

darshankawar commented 1 year ago

Thanks for the detailed report @juanleondev Can you check this issue and underlying comments and see if it helps in your case or not ?

juanleondev commented 1 year ago

Hi @darshankawar ! Thanks for replying. I tried that solution but it doesn't work. Also, I tried the solution to this issue and it doesn't work too :(

Screenshot 2023-08-21 at 07 37 52
tiendung01023 commented 1 year ago

Hi @juanleondev, Please check on that device and disable iCloud Private Relay in Settings

juanleondev commented 1 year ago

Hi @tiendung01023 ! I don't have iCloud+ so I suppose private relay is disabled 🤔

darshankawar commented 1 year ago

@juanleondev I used the plugin example, ran it on iOS device in --release mode. Generated a short link, pasted it in notes app. Terminated the app and then tapped on the short link from notes which opened and took me to the correct screen as shown below:

https://github.com/firebase/flutterfire/assets/67046386/4ca13517-eeb0-4870-ba60-eeb804da09de

Can you try the same example and check if you are missing any config or implementation ?

juanleondev commented 1 year ago

@darshankawar , it is working 🎉 , I used the example with my iOS project credentials. I have a question, the example is using the listen stream to recognize the 'initial link' is it correct? In my implementation (in the real project) I was using final initialPath = await dynamicLinkService.getInitialPath(); in the main method before launching the app.

darshankawar commented 1 year ago

That is correct. Good to know your issue is resolved. Closing as such.