I have some problem for decoding image data from base 64 encoded string.
I am using base64.h and base 64.m files downloaded from the following link
http://cdn.imthi.com/e6cef8/wp-content/uploads/2010/08/base64.zip
This is my code
[Base64 initialize];
NSData * data = [Base64 decode:imageString];
imgview.image=[UIImage imageWithData:data];
but, nothing displayed in the image view ,
I tested by decoding the base 64 string(taken from debugger console) with an online base 64 decoder,It gives correct image,
I also tested by writing the data to a file like this
[data writeToFile:imagePath atomically:YES];
it gives a jpg file but i can’t open that image file,
it gives error message like
The file “test.jpg” could not be opened.
“It may be damaged or use a file format that Preview doesn’t recognize.”
What is the problem with my code
Can anyone help me…..
Thank you
Try a different base 64 implementation, I use the one from colloquy open source project:
Get
NSAdditionsfiles: NSAdditions.h + NSAdditions.m