[[+content_image]]
E
E
Egor Sh2016-04-28 11:36:04
Objective-C
Egor Sh, 2016-04-28 11:36:04

How to decode base64 string coming from server?

I'm trying to decode a string like this

NSData *decodedData = [[NSData alloc] initWithBase64EncodedString:htmlText options:0];
    NSString *decodedString = [[NSString alloc] initWithData:decodedData encoding:NSUTF8StringEncoding];
    NSLog(@"%@", decodedString);

But I get null, I thought that the Base64 string itself was broken, but the online service decoded it normally, what could be the problem? Is there a line length limit?

Answer the question

In order to leave comments, you need to log in

[[+comments_count]] answer(s)
A
Anton Marunko, 2016-04-28
@Antonio-banderas

decoded data not nil?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question