Wednesday, January 10, 2024
HomeiOS Developmentflutter - Deep Hyperlinks not working in iOS (App is opening however...

flutter – Deep Hyperlinks not working in iOS (App is opening however the hyperlink will not be accessible) however working fantastic in Android


I’m utilizing the Dynamic Linking and Deep Linking in my e-Commerce Utility.
The Deep Hyperlinks when clicked on the Android Gadgets are working fantastic and displaying the meant behaviour.
However when the identical hyperlink is clicked on the iOS App, the App will get opened efficiently, however the hyperlinks which is clicked will not be accessible within the operate.

Beforehand I used to be utilizing the under code for listening the Deep Hyperlinks and Dynamic Hyperlinks:

In most important.dart file:

Future<void> initUniLinks() async {
    attempt {
      // Adjustments to implement the Dynamic Linking Performance.
      PendingDynamicLinkData? initialLink = await FirebaseDynamicLinks.occasion.getInitialLink();
      if (initialLink == null) {
        debugPrint('No Dynamic URI');
        closing uri = await getInitialUri();
        if (uri == null) {
          debugPrint('no preliminary uri');
        } else {
          debugPrint("Deeplink URL ${uri.toString()}");
          CommonEntities.deeplinkURL = uri;
        }
      } else {
        debugPrint("Dynamic URL ${initialLink.hyperlink.toString()}");
        CommonEntities.deeplinkURL = initialLink.hyperlink;
      }
    } on PlatformException {
      // Platform messages could fail however we ignore the exception
      debugPrint('did not get preliminary uri');
    } on FormatException {
      // FormatException will likely be thrown if the hyperlink was not the proper format
      debugPrint('malformed preliminary uri');
    }
  }

In home_screen.dart:

Future<void> initUniLinks() async {
    // BOC to test whether or not there may be any Dynamic Hyperlink CLicked or not.
    FirebaseDynamicLinks.occasion.onLink.hear((dynamicLinkData) {
      debugPrint("DynamicLink URL ${dynamicLinkData.hyperlink.toString()}");
      _callApiToPerformDeepLinking(dynamicLinkData.hyperlink.toString()); // Perform to name the API to deal with the Deep Hyperlink
    }).onError((error) {
      debugPrint(error.toString());
    });
  }

Then I discovered that we have to hear the hyperlinks within the iOS App utilizing the “uriLinkStream.hear”, so theI needed to replace the code of my home_screen.dart file and now the up to date code is as follows:

Future<void> initUniLinks() async {
    bool _isDynamicLinkFound = false;
    // BOC to test whether or not there may be any Dynamic Hyperlink CLicked or not.
    FirebaseDynamicLinks.occasion.onLink.hear((dynamicLinkData) {
      debugPrint("DynamicLink URL ${dynamicLinkData.hyperlink.toString()}");
      _isDynamicLinkFound = true;
      _callApiToPerformDeepLinking(dynamicLinkData.hyperlink.toString()); // Perform to name the API to deal with the Deep Hyperlink
    }).onError((error) {
      debugPrint(error.toString());
    });
    // BOC to test for deeplink is offered or not if no Dynamic Hyperlink is offered.
    if (!_isDynamicLinkFound) {
      // Connect a listener to the stream
      uriLinkStream.hear((Uri? uri) {
        debugPrint("DeepLink URL ${uri.toString()}");
        _callApiToPerformDeepLinking(uri.toString());
      }, onError: (err) {
        debugPrint(err.toString());
      });
    }
  }

After making use of the above change, not the app is opening when clicking the hyperlinks, however the hyperlink which is clicked will not be accessible in any of the capabilities of each information.

So is there anybody can please assist me to determine the lacking hyperlink?



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments