encode image to base64, get a invalid base64 string (ios using base64EncodedStringWithOptions)

后端 未结 4 747
误落风尘
误落风尘 2021-02-05 19:39

Here is my code.

  UIImage *img = [UIImage imageNamed:@\"white.jpeg\"];
  NSData *imageData = UIImagePNGRepresentation(img);
  NSString *imageString = [imageData         


        
4条回答
  •  再見小時候
    2021-02-05 20:15

    inspired from Fadi Abuzant answer here is the Swift 3 version

    stringBase64 = stringBase64.replacingOccurrences(of: "+", with: "%2B")
    

提交回复
热议问题