[英]How to upload image with other data into the google drive app specific folder and get back into the app in json formate in Swift
找到解决方案
这不是正确的解决方案,但直到我没有得到确切的解决方案,这对我来说是完美的。
要上传带有其他请求数据的图像,我遵循了以下步骤:
斯威夫特 4
let dataObj = image.pngData()
斯威夫特 3
let dataObj = UIImagePNGRepresentation(image)
并使用 utf8 将此数据对象转换为字符串
let str = String(decoding: data, as: UTF8.self)
使用此字符串与其他请求参数或数据一起上传。
并且不要忘记提及类型,以便您可以轻松地将此字符串再次转换为数据,并且可以轻松地将数据、图像转换为数据。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.