英文:
App Icon is not appearing while sharing post via firebase dynamic link
问题
我成功创建了Firebase中的动态链接以分享帖子。然而,当我分享帖子时,应用程序图标不可见,而是显示Firebase的图标。除此之外,一切都正常工作。您能帮我解决这个问题吗?在此处查看图像
func sharePostWithDynamicLinking() {
guard let link = URL(string: "https://www.example.com/\(displayDataObject?.postId ?? 0)") else { return }
let dynamicLinksDomainURIPrefix = "https://www.example.com"
let linkBuilder = DynamicLinkComponents(link: link, domainURIPrefix: dynamicLinksDomainURIPrefix)
linkBuilder?.iOSParameters = DynamicLinkIOSParameters(bundleID: "") // 此处我已经提到了我的应用程序的Bundle ID
linkBuilder?.iOSParameters?.appStoreID = "" // 此处我已经提到了我的应用程序的appStoreID
linkBuilder?.iOSParameters?.minimumAppVersion = "1"
linkBuilder?.socialMetaTagParameters = DynamicLinkSocialMetaTagParameters()
linkBuilder?.socialMetaTagParameters?.title = "动态链接示例"
linkBuilder?.socialMetaTagParameters?.descriptionText = "无论应用是否安装,此链接都有效!"
guard let longDynamicLink = linkBuilder?.url else { return }
print("长动态链接 --> \(longDynamicLink)")
linkBuilder?.shorten { url, warnings, error in
if let error = error {
print("哦,糟糕!出错了! \(error)")
return
}
if let warnings = warnings {
for warning in warnings {
print("警告:\(warning)")
}
}
guard let url = url else { return }
print("我有一个要分享的短链接! \(url.absoluteString)")
self.shareItem(with: url)
}
}
// 分享动态链接
func shareItem(with url: URL) {
let activityView = UIActivityViewController(activityItems: , applicationActivities: nil)
if let topVC = UIApplication.topViewController() {
topVC.present(activityView, animated: true, completion: nil)
}
}
英文:
I successfully created a Dynamic Link in Firebase to share posts. However, when I share the post, the app icon is not visible and instead, Firebase's icon is displayed. Everything works fine other than this. Can you help me resolve this issue? see image here
func sharePostWithDynamicLinking() {
guard let link = URL(string: "https://www.example.com/\(displayDataObject?.postId ?? 0)") else { return }
let dynamicLinksDomainURIPrefix = "https://www.example.com"
let linkBuilder = DynamicLinkComponents(link: link, domainURIPrefix: dynamicLinksDomainURIPrefix)
linkBuilder?.iOSParameters = DynamicLinkIOSParameters(bundleID: "") // here I have mentioned my app's Bundle ID
linkBuilder?.iOSParameters?.appStoreID = "" // here I have mentioned my app's appStoreID
linkBuilder?.iOSParameters?.minimumAppVersion = "1"
linkBuilder?.socialMetaTagParameters = DynamicLinkSocialMetaTagParameters()
linkBuilder?.socialMetaTagParameters?.title = "Example of a Dynamic Link"
linkBuilder?.socialMetaTagParameters?.descriptionText = "This link works whether the app is installed or not!"
guard let longDynamicLink = linkBuilder?.url else { return }
print("longDynamicLink --> \(longDynamicLink)")
linkBuilder?.shorten { url, warnings, error in
if let error = error {
print("Oh no! Got an error! \(error)")
return
}
if let warnings = warnings {
for warning in warnings {
print("Warning: \(warning)")
}
}
guard let url = url else { return }
print("I have a short url to share! \(url.absoluteString)")
self.shareItem(with: url)
}
}
// Share dynamic link
func shareItem(with url: URL) {
let activityView = UIActivityViewController(activityItems: , applicationActivities: nil)
if let topVC = UIApplication.topViewController() {
topVC.present(activityView, animated: true, completion: nil)
}
}
答案1
得分: 1
根据 Firebase 官方链接,您可以在 socilMetaTagParameter
中放置图像。
linkBuilder.socialMetaTagParameters.imageURL = "https://www.example.com/my-image.jpg"
查看此链接以获取更多信息:
https://firebase.google.com/docs/dynamic-links/ios/create?hl=es-419
英文:
according to the firebase official link, you can put image in socilMetaTagParameter
linkBuilder.socialMetaTagParameters.imageURL = "https://www.example.com/my-image.jpg"
check this link for further information
https://firebase.google.com/docs/dynamic-links/ios/create?hl=es-419
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论