App图标在通过Firebase动态链接分享帖子时未显示。

huangapple go评论115阅读模式
英文:

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

App图标在通过Firebase动态链接分享帖子时未显示。

英文:

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
App图标在通过Firebase动态链接分享帖子时未显示。

huangapple
  • 本文由 发表于 2023年7月31日 19:28:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/76803191.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定