我将图像转换为base64字符串,然后使用xcode和Swift将它们上传到MySQL,但是当使用android studio以Json格式下载它们时会出现错误的string64错误 我在android中使用了整个方法,例如URL safe等,而在xcode中使用了选项raw zero 有人会帮我这个 感谢名单
override func viewDidLoad() {
super.viewDidLoad()
imgview.image = UIImage(named: "sexy")
let image : UIImage = UIImage(named:"maddona")!
let imageData:Data = UIImagePNGRepresentation(image)!
let strBase64:String = imageData.base64EncodedString()
这是java fetch
civ = (ImageView) findViewById(R.id.imageView);
String imageFetched = " this is the fetched string from json " byte[] imageAsBytes = Base64.decode(imageFetched.getBytes(), Base64.URL_SAFE);
civ.setImageBitmap(BitmapFactory.decodeByteArray(imageAsBytes, 0, imageAsBytes.length));