base64 to image with ios 16 create a black line on rigtht side, how to fix

when i turn a base64 str to image, it will create a black line on right side.

this only happen in ios 16, can anyone fix?

Accepted Answer

I don’t think this has anything to do with Foundation, but there’s an easy way to prove that: Dump the contents of decodedImageData on both iOS 15 and iOS 16. They are identical, right? If so, the Base64 stuff worked just fine and the issue is with UIImage or the code you’re using to display that image.

I can’t help you with UIKit stuff but I’ve retagged your question so that interested folks see it.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

When I paste your base64 string into an online base64 decoder, it produces a JPEG that doesn't appear (at least not in Preview) to produce a black line, but I'm not passing that string through whatever stringPaddedForBase64 does first. Perhaps the issue lies there?

I'm sorry that I didn't describe it clearly

There are 4 scenarios in total:

1、paste the base64 string into an online base64 decoder, it' OK

2、run my code with an iphone simulator in any ios version system, it' OK

3、run my code with an iphone machine on ios version < 16 , it' OK

4、run my code with an iphone machine on ios version >= 16 , it' not OK

In the eraly time, I suspected there is something wrong with my code,But I had tried many times, It still didn't work.

please help me.

thank you so much.

base64 to image with ios 16 create a black line on rigtht side, how to fix
 
 
Q