Reputation: 1060
I have encoded string in base64 and want to decode it but getting nil
in NSData *decodedData
. NSString *images
contains encoded string.
NSString *images = encoded string;
NSData *decodedData = [[NSData alloc] initWithBase64EncodedString:images options:0];
UIImage *myImage = [UIImage imageWithData:decodedData];
Upvotes: 0
Views: 142
Reputation: 8168
Perhaps you have unknown characters? Try passing NSDataBase64DecodingIgnoreUnknownCharacters
into the options:
parameter.
Upvotes: 2