关于iOS9禁用的那些api取代方法

列表:(1)- (NSString *)stringByAddingPercentEscapesUsingEncoding:(NSStringEncoding)encoding

(2)UIAlertView 、ActionSheet 在iOS9 中由 UIAlertController取代

(3)NSURLConnection sendSynchronousRequest.../sendAsynchronousRequest... deprecated,现在只能使用NSURLSession

(4)stretchableImageWithLeftCapWidth:topCapHeight:  deprecated in iOS2.0,

use resizableImageWithCapInsets:

(1)- (NSString *)stringByAddingPercentEscapesUsingEncoding:(NSStringEncoding)encoding

原用法:

NSString *urlString = @"jianshu.com";

urlString = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

NSURL *url = [NSURL URLWithString:urlString];

新用法:

For Objective-C:

NSString *str = ...; // some URL

NSCharacterSet *set = [NSCharacterSet URLHostAllowedCharacterSet];

NSString *result = [str stringByAddingPercentEncodingWithAllowedCharacters:set];

取代

来源:http://stackoverflow.com/questions/32242712/replacement-for-stringbyaddingpercentescapesusingencoding-in-ios9

(2)UIAlertView 、ActionSheet 在iOS9 中由 UIAlertController取代

另:UIAlertController 可增加UITextField

来源:http://stackoverflow.com/questions/32690086/uialertview-first-deprecated-ios-9

(3)NSURLConnection sendSynchronousRequest/sendAsynchronousRequest deprecated,现在只能使用NSURLSession

http://stackoverflow.com/questions/32441229/nsurlconnection-deprecated-in-ios9

(4)http://jayrparro.com/blog/2012/05/17/stretchable-images-in-ios-5

你可能感兴趣的:(关于iOS9禁用的那些api取代方法)