问题
I updated Firebase Dynamic Link pod to 1.4 version. In this version I found very useful class named FIRDynamicLinkComponents
. I decided to use it to generate dynamic links. But I have 2 problems:
- Firebase doc says that dynamic links can survive installation process and open app on the content I described in dynamic link after installation from AppStore. It is not work.
- When user without installed app taps on dynamic links, he will see strange screen with button "Open in App". After click AppStore appears.
Can we skip this screen?
My implementation:
static func createDynamicLinks(forChallangeId challangeId: String, authorId: String, authorEmail: String, completion: @escaping (_ dynamicLink: String?, _ error: Error?) -> Void) {
let link = URL(string: "https://CODE.app.goo.gl/challange/\(challangeId)/author/\(authorId)")!
let domain = DOMAIN
let components = FIRDynamicLinkComponents(link: link, domain: domain)
//add iOS params
let iOSParams = FIRDynamicLinkIOSParameters(bundleID: bundleId)
iOSParams.appStoreID = APP_STORE_ID
components.iOSParameters = iOSParams
//add Android params
let androidParams = FIRDynamicLinkAndroidParameters(packageName: PACKAGE_NAME)
androidParams.minimumVersion = 19
components.androidParameters = androidParams
//add social meta tag params
let socialParams = FIRDynamicLinkSocialMetaTagParameters()
socialParams.title = "You got new challenge"
socialParams.descriptionText = "\(authorEmail) sent the challenge to you."
socialParams.imageURL = IMAGE_URL
components.socialMetaTagParameters = socialParams
//add options
let options = FIRDynamicLinkComponentsOptions()
options.pathLength = .short
components.options = options
//make link shorter
components.shorten { (shortURL, warnings, error) in
if let error = error {
completion(nil, error)
return
}
guard let shortLinkString = shortURL?.absoluteString else {
completion(nil, error)
return
}
completion(shortLinkString, error)
}
}
Edit
3rd problem.
Target iOS10. Handle:
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool {
guard let dynamicLinks = FIRDynamicLinks.dynamicLinks() else {
return false
}
let handled = dynamicLinks.handleUniversalLink(userActivity.webpageURL!) { (dynamiclink, error) in
if let url = dynamiclink?.url {
DynamicLinksManager.handleDeepLink(link: url)
}
}
return handled
}
handled
is true but in closure dynamiclink
and error
are nil.
回答1:
A lot of solutions depend on having more context than you've currently included. I'll edit this answer with updates as possible.
- Dynamic Links definitely can survive the installation process in most situations. However, there are a lot of edge cases. Could you add specific reproduction steps for exactly the process you're using to test?
- No, unfortunately this modal cannot be skipped. Apple made some changes in iOS 10.3 that make something like this unavoidable (read here for more on what happened, and how we handled the same problem in a slightly more elegant way at Branch)
- This might be expected, if no valid Dynamic Link were triggered. Again, could you add specific reproduction steps?
来源:https://stackoverflow.com/questions/43802446/firebase-dynamic-links-does-not-survive-installation-process