我在iOS中比较新鲜,我想知道什么时候我们应该copy在一个属性中使用,例如
@property (nonatomic, retain) NSString* name;
Run Code Online (Sandbox Code Playgroud)
VS
@property (nonatomic, copy) NSString* name;`
Run Code Online (Sandbox Code Playgroud)
retain和之间有什么区别,什么copy时候应该使用一个而不是另一个?
我的resultString是'PHNhbWxwOlJlc3BvbnNlIH ... c3BvbnNlPgoK',当我解码时,它向我显示了decodedData为nil。
NSData * decodedData = [[NSData alloc] initWithBase64EncodedString:resultString options:0];
我还使用https://www.base64decode.org/尝试了此字符串,它成功显示了结果。
解码这里有什么问题?