gpt4 book ai didi

swift - swift3 上的 Facebook OpenGraphContent

转载 作者:行者123 更新时间:2023-11-30 12:43:57 25 4
gpt4 key购买 nike

我尝试将 Open Graph Story 与最新的 Facebook SDK for Swift 集成,但收到错误“无法推断通用参数“内容””

let object: OpenGraphObject = [
"og:type": "books.book",
"og:title": "A Game of Thrones",
"og:description": "In the frozen wastes to the north of Winterfell, sinister and supernatural forces are mustering.",
"books:isbn": "0-553-57340-3"
]
// Create an action
var action = OpenGraphAction(type: "book.reads")
action["books:book"] = object
// Create the content
var content = OpenGraphShareContent()
content.action = action
content.previewPropertyName = "books:book"
try ShareDialog.show(from: self, content: content) //Here i'm getting "generic parameter 'Content' could not be inferred"

有人知道解决办法吗?

最佳答案

据我从 commit log 中了解到的,该模块不再维护。相反,请使用 FBSDKShareKit 模块(例如来自 Cocoapods 的 use_frameworks!)。那么你应该能够做到

import FBSDKShareKit

...

// Create an object
let object = FBSDKShareOpenGraphObject.init(properties: [
"og:type": "books.book",
"og:title": "A Game of Thrones",
"og:description": "In the frozen wastes to the north of Winterfell, sinister and supernatural forces are mustering.",
"books:isbn": "0-553-57340-3"
])

// Create an action
let action = FBSDKShareOpenGraphAction.init()
action.actionType = "books.reads"
action.setObject(object, forKey: "books:book")

// Create the content

let content = FBSDKShareOpenGraphContent.init()
content.action = action
content.previewPropertyName = "books:book"

FBSDKShareDialog.show(from: self, with: content, delegate: self)

关于swift - swift3 上的 Facebook OpenGraphContent,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41888825/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com