我试图在呈现的视图控制器中使用FacebookShare Swift SDK 0.3.2而不是FBSDKShareKit来显示Facebook ShareDialog,并具有以下功能
import FacebookShare
func facebookShare() {
let photo = Photo(image: image, userGenerated: true)
let myContent = PhotoShareContent(photos: [photo])
let shareDialog = ShareDialog(content: myContent)
shareDialog.presentingViewController = self
shareDialog.mode = .automatic
shareDialog.completion = { result in
print("- in completion")
}
do {
try shareDialog.show()
} catch {
print(error)
}
我在控制台中收到此错误。
2018-09-03 16:12:11.235865 + 0100 APPNAME [1865:386979] FBSDKLog:param { “ advertiser_tracking_enabled” = 0; “ anon_id” =“ XXXXX-XXXXXX-XXXXX-XXXXX”; “ application_tracking_enabled” = 1; “ custom_events” =“ [{\” _ ui \“:\” no_ui \“,\” _ eventName \“:\” fb_dialog_share_result \“,\” _ logTime \“:1535987524,\” fb_dialog_outcome_error_message \“:\”错误 Domain = com.facebook.sdk.share代码= 2 \\“(空)\\” UserInfo = {com.facebook.sdk:FBSDKErrorArgumentValueKey =,com.facebook.sdk:FBSDKErrorDeveloperMessageKey =必须具备 资产,图像或imageURL值。, com.facebook.sdk:FBSDKErrorArgumentNameKey = photo} \“,\” fb_dialog_outcome \“:\”失败\“,\” _ implicitlyLogged \“:\” 1 \“}]”“; event =“ CUSTOM_APP_EVENTS”; extinfo =“ [\” i2 \“,\” com.APPNAME \“,\” 1 \“,\” 1.0 \“,\” 11.4.1 \“,\” iPhone8,4 \“,\” en_GB \ “,\” BST \“,\”三个\“,320,568,\” 2.00 \“,2,60,46,\”欧洲\ /伦敦\“]”; “ url_schemes” =“ [\” fbapiXXXXXXX \“,\” fbXXXXXXXXX \“,\” twitterkit-sasasasasasasa \“,\” com.googleusercontent.apps.XXXXXXXXXX-XXXXXXXX \“]”; }
尽管错误提示:
必须具有资产,图像或imageURL值。
我已确认UIImage包含在myContent中,该UIImage已通过断点传递给ShareDialog。
答案 0 :(得分:0)
这是FacebookSDK的问题,已在此处提出:
https://github.com/facebook/facebook-sdk-swift/issues/264
临时解决方法,直到修复,从pod文件中删除Facebook pod并添加以下内容,然后运行pod install。
pod 'FacebookCore', '0.3.1'
pod 'FacebookLogin', '0.3.1'
pod 'FacebookShare', '0.3.1'
pod 'FBSDKCoreKit', '4.35.0'
pod 'FBSDKLoginKit', '4.35.0'
pod 'FBSDKShareKit', '4.35.0'