简体   繁体   English

Firebase 短动态链接 URL 未按预期工作

[英]Firebase Dynamic Links Short URL not working as expected

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.指定的自定义 URL 方案为 com.*****.** 并且 Info.plist 在 CFBundleURLTypes key.performDiagnostic 中包含此类方案已成功完成。 No errors found.没有发现错误。

Issue 1:问题 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).动态链接短 URL 正在通过模拟器中的 Safari 浏览器工作(显示预览屏幕以打开应用程序而不是直接打开应用程序。虽然在真实设备上不起作用。附上屏幕截图)。 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.但是,它无法通过 Email、Skype 或 WhatsApp 等工作。在所有情况下,通过使用UserActivity详细信息触发continueUserActivity来唤醒应用程序。

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. userActivity.webpageURL返回Long URLuserActivity.referrerURL返回我的Short URL ,同时通过模拟器上的 Safari 浏览器预览屏幕唤醒应用程序。

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. userActivity.webpageURL返回Short URL (而不是Long URL )并且userActivity.referrerURL返回https://mail.google.com/mail/mu/mp/789/ (而不是Short URL )同时唤醒应用程序Email、Skype 或 WhatsApp 等。

Issue 2:问题 2:

handleUniversalLink callback is always returns NO . handleUniversalLink回调总是返回NO I called stringByRemovingPercentEncoding to the userActivity.webpageURL before passing it to the handleUniversalLink .在将它传递给userActivity.webpageURL之前,我将stringByRemovingPercentEncoding调用给handleUniversalLink Still no luck.仍然没有运气。

Long URL Example:长 URL 示例:

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 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%2Amazonaws%2Ecom%2FReferralProgram%2F1583824361%5F1638450020%2Ejpg&sd=SHARE%20WITH%20YOUR%20FRIENDS&st=test&apn=com%2Edomain%2Eandroidappname

Short URL Example:简称 URL 示例:

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

Long & Short URL Generation Code Long & Short URL 代号

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: AppDelegate代码:

- (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.应用程序在 AppStore 中尚不可用。
  2. We tested using the release build.我们使用发布版本进行了测试。 Beta review is not processed on these builds.不会对这些构建进行 Beta 审核。
  3. We are using ObjectiveC我们正在使用 ObjectiveC

Any Help on this is highly appreciated.非常感谢对此的任何帮助。 Thank you in advance.先感谢您。

在此处输入图像描述

if you don't want to showing a preview screen to open the app如果您不想显示预览屏幕来打开应用程序

You need to check mark Skip the app preview page您需要勾选跳过应用预览页面

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Firebase 动态链接 Android fallbackURL 不起作用 - Firebase dynamic links Android fallbackURL is not working Flutter Firebase 动态链接不适用于 facebook - Flutter Firebase Dynamic Links Not working on facebook Firebase 动态链接不适用于带电容器的 ios - Firebase Dynamic links not working for ios with capacitor Firebase动态链接每天可以生成多少个短网址? - How many short urls can be generated per day for Firebase Dynamic Links? 使用 Firebase 重定向 URL 动态/深层链接正在丢失查询参数 - Redirect URL using Firebase Dynamic / Deep Links is losing query parameters firebase 条带中的动态链接抛出 err_unknown_url_scheme - firebase dynamic links in stripe throws err_unknown_url_scheme Firebase 托管复制和粘贴动态 url 不工作 - Firebase Hosting copy and paste dynamic url not working Flutter firebase 动态链接在应用程序上处理 url 时使用自定义参数自定义链接 - Flutter firebase dynamic links customise link with custom params when handling url on the app 信息 | Slack - Firebase 动态链接缩短 URL 不工作 - iMessage | Slack - Firebase Dynamic Link shorten URL is not working Firebase 动态链接是否适用于 PWA 应用程序? - Do firebase dynamic links work with PWA applications?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM