FacebookShare 0.3.2 Swift ShareDialog 控制台错误
FacebookShare 0.3.2 Swift ShareDialog console error
我正在尝试使用 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\":\"Error
Domain=com.facebook.sdk.share Code=2 \"(null)\"
UserInfo={com.facebook.sdk:FBSDKErrorArgumentValueKey=, com.facebook.sdk:FBSDKErrorDeveloperMessageKey=Must have
an asset, image, or imageURL value.,
com.facebook.sdk:FBSDKErrorArgumentNameKey=photo}\",\"fb_dialog_outcome\":\"Failed\",\"_implicitlyLogged\":\"1\"}]";
event = "CUSTOM_APP_EVENTS";
extinfo = "[\"i2\",\"com.APPNAME\",\"1\",\"1.0\",\"11.4.1\",\"iPhone8,4\",\"en_GB\",\"BST\",\"Three\",320,568,\"2.00\",2,60,46,\"Europe\/London\"]";
"url_schemes" = "[\"fbapiXXXXXXX\",\"fbXXXXXXXXX\",\"twitterkit-sasasasasasasa\",\"com.googleusercontent.apps.XXXXXXXXXX-XXXXXXXX\"]";
}
虽然错误说:
Must have an asset, image, or imageURL value.
我已确认 UIImage 位于 myContent 中,让其通过断点传递给 ShareDialog。
这是 FacebookSDK 的一个问题,已在此处提出:
https://github.com/facebook/facebook-sdk-swift/issues/264
修复前的临时解决方法,从 pod 文件中删除 Facebook pods 并添加以下内容,然后 运行 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'
我正在尝试使用 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\":\"Error Domain=com.facebook.sdk.share Code=2 \"(null)\" UserInfo={com.facebook.sdk:FBSDKErrorArgumentValueKey=, com.facebook.sdk:FBSDKErrorDeveloperMessageKey=Must have an asset, image, or imageURL value., com.facebook.sdk:FBSDKErrorArgumentNameKey=photo}\",\"fb_dialog_outcome\":\"Failed\",\"_implicitlyLogged\":\"1\"}]"; event = "CUSTOM_APP_EVENTS"; extinfo = "[\"i2\",\"com.APPNAME\",\"1\",\"1.0\",\"11.4.1\",\"iPhone8,4\",\"en_GB\",\"BST\",\"Three\",320,568,\"2.00\",2,60,46,\"Europe\/London\"]"; "url_schemes" = "[\"fbapiXXXXXXX\",\"fbXXXXXXXXX\",\"twitterkit-sasasasasasasa\",\"com.googleusercontent.apps.XXXXXXXXXX-XXXXXXXX\"]"; }
虽然错误说:
Must have an asset, image, or imageURL value.
我已确认 UIImage 位于 myContent 中,让其通过断点传递给 ShareDialog。
这是 FacebookSDK 的一个问题,已在此处提出:
https://github.com/facebook/facebook-sdk-swift/issues/264
修复前的临时解决方法,从 pod 文件中删除 Facebook pods 并添加以下内容,然后 运行 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'