我使用更快的图书馆试图发布一条带有照片的推特,但每次尝试,我都会得到一个错误:“操作无法完成。(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).....这样的普通香草推特的时候
一切都很好,只有当我试图发布一张照片时,我才会有问题。请帮帮忙。提前感谢
发布于 2018-04-10 13:01:47
我找到了解决办法。照片一定很小。文档显示,甚至小于5mb。我用了一张只有100 an的图像,它起作用了。如果我想发布更大的图片/视频(甚至只有一张图片),你必须使用分块的媒体帖子功能。
https://stackoverflow.com/questions/49691187
复制相似问题