1
votes

I'm experiencing two issues with the Dynamic Links. I turned-on the app Diagnostics and the Log says no errors.

Specified custom URL scheme is com.*****.** and Info.plist contains such scheme in CFBundleURLTypes key.performDiagnostic completed successfully! No errors found.

Issue 1:

Dynamic Link short URL's are working through the Safari browser in the Simulator (showing a preview screen to open the app instead of opening the app directly. Not working on the real device though. Attaching the screenshot). However, it is not working through Email, Skype or WhatsApp etc. The app is woken in all cases by triggering continueUserActivity with the UserActivity details. 

The userActivity.webpageURL returns the Long URL and userActivity.referrerURL returns my Short URL while waking the app though the Safari browser preview screen on the Simulator.

The userActivity.webpageURL returns the  Short URL(instead of the Long URL) and userActivity.referrerURL returns https://mail.google.com/mail/mu/mp/789/ (instead of the Short URL) while waken the app through Email, Skype or WhatsApp etc.

Issue 2:

handleUniversalLink callback is always returns NO. I called stringByRemovingPercentEncoding to the userActivity.webpageURL before passing it to the handleUniversalLink. Still no luck.

Long URL Example:

baseurl.com/?isi=1505486543&ibi=com%2Eappname%2Eiosappname&link=https%3A%2F%2Fstaging%2Edomain%2Ecom%2F%3Freferral%2Dcode%1234569&si=https%3A%2F%2Fappname%2Dstaging%2Es3%2Dap%2Dsitename%2D1%2Eamazonaws%2Ecom%2FReferralProgram%2F1583824361%5F1638450020%2Ejpg&sd=SHARE%20WITH%20YOUR%20FRIENDS&st=test&apn=com%2Edomain%2Eandroidappname

Short URL Example:

https://domain-deeplink-link.com/123456

Long & Short URL Generation Code

NSURL *link = [[NSURL alloc] initWithString:[kBaseURLForShare stringByAppendingString:[NSString stringWithFormat:@"?referral-code=%@", self.lblReferralID.text]]];
NSString *dynamicLinksDomainURIPrefix = @"deeplink_url.com";
FIRDynamicLinkComponents *linkBuilder = [[FIRDynamicLinkComponents alloc]
                                         initWithLink:link
                                         domain:dynamicLinksDomainURIPrefix];

//iOS params
linkBuilder.iOSParameters = [[FIRDynamicLinkIOSParameters alloc]
                             initWithBundleID:@"iosbundle_id"];
linkBuilder.iOSParameters.appStoreID = @"store_id";

//Android params
linkBuilder.androidParameters = [[FIRDynamicLinkAndroidParameters alloc]
                                 initWithPackageName:@"android_bundle_id"];

//Social params
linkBuilder.socialMetaTagParameters = [[FIRDynamicLinkSocialMetaTagParameters alloc] init];

if (self.bannerInfo.title.length > 0) {
  linkBuilder.socialMetaTagParameters.title = self.bannerInfo.title;
}
if (self.bannerInfo.sharedDescription.length > 0) {
  linkBuilder.socialMetaTagParameters.descriptionText = self.bannerInfo.sharedDescription;
}
if (self.bannerInfo.bannerURL.length > 0) {
    linkBuilder.socialMetaTagParameters.imageURL = [NSURL URLWithString:[kBaseURLForFiles stringByAppendingString:_bannerInfo.bannerURL]];
}

[FIRDynamicLinkComponents shortenURL:linkBuilder.url
                                options:nil
                             completion:^(NSURL * _Nullable shortURL,
                                          NSArray<NSString *> * _Nullable warnings,
                                          NSError * _Nullable error) {

    dispatch_async(dispatch_get_main_queue(), ^{
        [self->_progressHUD hideWithoutAnimation];
        self->_progressHUD = nil;

        if (error) {
            [self showToast:error.localizedDescription];
        }
        else if (shortURL == nil) {
            [self showToast:@"No deeplink URL found!"];
        }
        else {
            [self shareReferralProgramToApps:shortURL.absoluteString Sender:sender];
        }
    });
}];

AppDelegate Code:

- (BOOL)application:(UIApplication *)application
            openURL:(NSURL *)url
  sourceApplication:(NSString *)sourceApplication
         annotation:(id)annotation {
  FIRDynamicLink *dynamicLink = [[FIRDynamicLinks dynamicLinks] dynamicLinkFromCustomSchemeURL:url];

  if (dynamicLink) {
    if (dynamicLink.url) {
        [self processDynamicURL:dynamicLink.url.absoluteString];
    } else {
      // Dynamic link has empty deep link. This situation will happens if
      // Firebase Dynamic Links iOS SDK tried to retrieve pending dynamic link,
      // but pending link is not available for this device/App combination.
      // At this point you may display default onboarding view.
    }
    return YES;
  }
  return NO;
}

- (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity
 restorationHandler:
#if defined(__IPHONE_12_0) && (__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_12_0)
(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> *_Nullable))restorationHandler {
#else
    (nonnull void (^)(NSArray *_Nullable))restorationHandler {
#endif  // __IPHONE_12_0
  NSURL *activityURL = [NSURL URLWithString:[userActivity.webpageURL.absoluteString stringByRemovingPercentEncoding]];
  BOOL handled = [[FIRDynamicLinks dynamicLinks] handleUniversalLink:activityURL
                                                          completion:^(FIRDynamicLink * _Nullable dynamicLink,
                                                                       NSError * _Nullable error) {
      [self processDynamicURL:dynamicLink.url.absoluteString];
  }];
  return handled;
}

Additional Notes:

  1. App is not available in the AppStore yet.
  2. We tested using the release build. Beta review is not processed on these builds.
  3. We are using ObjectiveC

Any Help on this is highly appreciated. Thank you in advance.

enter image description here

1

1 Answers

0
votes

if you don't want to showing a preview screen to open the app

You need to check mark Skip the app preview page

enter image description here