How to decode Base64 string that comes from the server?

Trying to decode a string like so
NSData *decodedData = [[NSData alloc] initWithBase64EncodedString:htmlText options:0];
 NSString *decodedString = [[NSString alloc] initWithData:decodedData encoding:NSUTF8StringEncoding];
 NSLog(@"%@", decodedString);


But always get null, I thought that the Base64 string is broken, but the online service unescape normal, what could be the problem? Is there a limit on length of string?
July 12th 19 at 17:24
1 answer
July 12th 19 at 17:26
decoded data is not nil?
Yes, already figured out, it turns out that the server sent is not Utf8 - Sterling_Farre commented on July 12th 19 at 17:29
fire - magdalena.Konopelski22 commented on July 12th 19 at 17:32

Find more questions by tags iOSObjective-C