Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个NSString包含例如编码字符串的对象:Tm8gMQ==
NSString
Tm8gMQ==
因为我恢复的是一个NSString对象而不是一个NSData对象,我想怎么做decode呢?
NSData
decode
谢谢你。
使用NSDATA-BASE64 扩展
NSString *nice=@"Tm8gMQ=="; NSData *data = [NSData dataFromBase64String:nice]; NSString *convertedString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; NSLog(@"%@",convertedString);
输出
2013-06-13 17:23:58.467 Cool[5395:11303] No 1