已成功将通用链接集成到应用程序中,如果未安装应用程序,请指导如何重定向到存储链接,请提出正确的使用方法
答案 0 :(得分:0)
请尝试以下操作:
guard let link = URL(string: sahareUrl) else { return }
let dynamicLinksDomain = "name.page.link"
let linkBuilder = FIRDynamicLinkComponents(link: link, domain: dynamicLinksDomain)
linkBuilder.socialMetaTagParameters = FIRDynamicLinkSocialMetaTagParameters()
linkBuilder.options = FIRDynamicLinkComponentsOptions()
linkBuilder.options?.pathLength = .short
linkBuilder.socialMetaTagParameters?.imageURL = URL(string: imagename)
linkBuilder.iOSParameters = FIRDynamicLinkIOSParameters(bundleID: "yourBundleId")
linkBuilder.iOSParameters?.appStoreID = "storeId"
linkBuilder.iOSParameters?.iPadBundleID = "yourBundleId"
linkBuilder.androidParameters = FIRDynamicLinkAndroidParameters(packageName: "packageNameOfAndroid")
linkBuilder.socialMetaTagParameters?.title = title
linkBuilder.socialMetaTagParameters?.descriptionText = description
guard let longDynamicLink = linkBuilder.url else { return }
print(longDynamicLink)
FIRDynamicLinkComponents.shortenURL(longDynamicLink, options: nil) { url, warnings, error in
self.runOnUIThread {
if url != nil{
self.shareAds(item: [url!])
}else{
NVActivityIndicatorHelper.hideIndicatorInView()
}
}
}
这可能会对您有所帮助。谢谢