initwithbase64encoding IS deprecated:first depercated in iOS 7.0
- (nullable id)initWithBase64Encoding:(NSString *)base64String NS_DEPRECATED(10_6, 10_9, 4_0, 7_0);
/* These methods first appeared in NSData.h on OS X 10.9 and iOS 7.0. They are deprecated in the same releases in favor of the methods in the NSDataBase64Encoding category. However, these methods have existed for several releases, so they may be used for applications targeting releases prior to OS X 10.9 and iOS 7.0.
*/
这些方法首先出现在NSData。H在OS X 10.9和iOS 7。他们是在nsdatabase64encoding分类方法有利于同版本过时。然而,这些方法都存在几个版本,所以他们可以使用的应用程序,针对之前发布的OS X 10.9和iOS 7。
----->
initwithbase64encoding 方法过时
所以以下代码编译器会报错
//decoded = [[self alloc] initWithBase64Encoding:[string stringByReplacingOccurrencesOfString:@"[^A-Za-z0-9+/=]" withString:@"" options:NSRegularExpressionSearch range:NSMakeRange(0, [string length])]];
新的API OS 10.9 iOS7.0 可用
- (nullable instancetype)initWithBase64EncodedString:(NSString *)base64String options:(NSDataBase64DecodingOptions)options NS_AVAILABLE(10_9, 7_0);
decoded = [[self alloc] initWithBase64EncodedString:[string stringByReplacingOccurrencesOfString:@"[^A-Za-z0-9+/=]" withString:@"" options:NSRegularExpressionSearch range:NSMakeRange(0, [string length])] options:NSDataBase64DecodingIgnoreUnknownCharacters];