samedi 28 mars 2015

NSData isn't encoding image into Base64 string properly

I am using following simple code to convert Image to Base64 string in iOS



NSData *originalPhoto = UIImagePNGRepresentation([UIImage imageNamed:@"Time_Icon.png"]);
NSString *base64PhotoString = [originalPhoto base64EncodedStringWithOptions:0];


When i try to decode the string in base64PhotoString variable using one of the online Base64 image decode service image doesn't get reproduced, not sure whats going wrong. I am sending this string to a service there also image doesn't get recognised.


ok tried playing with the options and finally could get the image encoded which gets decoded using online tools properly , but still its not recognised on server side , server side programmer is using http://ift.tt/1F3Giaq this library to deserialise the JSON having image in it to object , it simply ignores the image , I am using RestKit to call server side , what i have realised is RestKit added escape characters to encoded image data , can that be a problem ?


Aucun commentaire:

Enregistrer un commentaire