【发布时间】:2016-09-21 00:22:54
【问题描述】:
我希望能够在单击动态链接时打开应用程序并打印参数(即使它没有发布)。
有没有办法做到这一点?
【问题讨论】:
-
你以前见过这个answer 吗?也许实现相同的,只在你需要的地方包含一些日志?
标签: firebase app-store firebase-dynamic-links
我希望能够在单击动态链接时打开应用程序并打印参数(即使它没有发布)。
有没有办法做到这一点?
【问题讨论】:
标签: firebase app-store firebase-dynamic-links
是的!事实上,我在入门视频(part 1)、(part 2) 中经历了这个确切的过程,如果你还没有,我建议你看看。
但是,一般来说,您只需单击动态链接即可测试“如果我安装了应用,请打开它”流程。如果您的应用程序安装在设备上,它应该可以正常打开;即使它不是已发布的应用。
如果你想测试未安装的流程,这也很简单。
【讨论】:
application: UIApplication, continue userActivity: NSUserActivity, restorationHandler 方法,但在未安装应用程序时会调用 app: UIApplication, open url: URL, options 方法。 @Todd Kerpelman 对吗?
我也遇到了同样的问题,在花了很多时间试图找到解决方案后,并按照 Todd Kerpelman post 解释的调试说明进行操作,我可以确定 firebase 没有首先发送通用链接应用启动并发送了具有以下结构的方案 URL:
[bundle_id]://google/link/?deep_link_id=[firebase_universal_link]
识别后,我在 Firesabe SDK 中找到了 dynamicLinkFromCustomSchemeURL 方法,我可以通过动态链接解决我在第一次启动应用时遇到的问题。
/**
* @method dynamicLinkFromCustomSchemeURL:
* @abstract Get a Dynamic Link from a custom scheme URL. This method parses URLs with a custom
* scheme, for instance, "comgoogleapp://google/link?deep_link_id=abc123". It is suggested to
* call it inside your |UIApplicationDelegate|'s
* |application:openURL:sourceApplication:annotation| and |application:openURL:options:|
* methods.
* @param url Custom scheme URL.
* @return Dynamic Link object if the URL is valid and has link parameter, otherwise nil.
*/
- (nullable FIRDynamicLink *)dynamicLinkFromCustomSchemeURL:(NSURL *)url
NS_SWIFT_NAME(dynamicLink(fromCustomSchemeURL:));
/**
* @method dynamicLinkFromUniversalLinkURL:completion:
* @abstract Get a Dynamic Link from a universal link URL. This method parses the universal link
* URLs, for instance,
* "https://example.page.link?link=https://www.google.com&ibi=com.google.app&ius=comgoogleapp".
* It is suggested to call it inside your |UIApplicationDelegate|'s
* |application:continueUserActivity:restorationHandler:| method.
* @param URL Custom scheme URL.
* @param completion A block that handles the outcome of attempting to get a Dynamic Link from a
* universal link URL.
*/
- (void)dynamicLinkFromUniversalLinkURL:(NSURL *)url
completion:(FIRDynamicLinkUniversalLinkHandler)completion
NS_SWIFT_NAME(dynamicLink(fromUniversalLink:completion:));
/**
* @method dynamicLinkFromUniversalLinkURL:
* @abstract Get a Dynamic Link from a universal link URL. This method parses universal link
* URLs, for instance,
* "https://example.page.link?link=https://www.google.com&ibi=com.google.app&ius=comgoogleapp".
* It is suggested to call it inside your |UIApplicationDelegate|'s
* |application:continueUserActivity:restorationHandler:| method.
* @param url Custom scheme URL.
* @return Dynamic Link object if the URL is valid and has link parameter, otherwise nil.
*/
【讨论】: