我正在使用Swifter Library尝试发布带有照片的推文,但每次尝试时,我都会收到错误消息“无法完成操作。(SwifteriOS.SwifterError 错误 1。)”
我的代码看起来像
var tweetMedia: [String: Any]?
//I then set tweetMedia to a UIImageView from the UIImagePickerControllerOriginalImage
let picForTwitterApi = tweetMedia![UIImagePickerControllerOriginalImage] as! UIImage
let image = UIImagePNGRepresentation(picForTwitterApi) as Data?
self.swifter?.postTweet(status: tweetText, media: image!, inReplyToStatusID: nil, coordinate: nil, placeID: nil, displayCoordinates: nil, trimUser: false,
tweetMode: TweetMode.default, success: { json in self.alert(title: "Tweet PHOTO sent", message: "")
}, failure: failureHandler)
但它不起作用,我什至尝试过
self.swifter?.postMedia(image!, additionalOwners: nil, success: { json in
print(json)
相反,仍然没有成功。当我发布一条普通的普通推文时
self.swifter?.postTweet(status: tweetText, inReplyToStatusID: nil, trimUser: false, tweetMode: TweetMode.default, success: { json in
print(json).....
一切都很好,我只有在尝试发布照片时遇到问题。请帮忙。提前致谢