美文网首页
关于iOS9禁用的那些api取代方法

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

作者: YH的练手记 | 来源:发表于2016-03-21 14:19 被阅读2007次

    列表:(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取代方法

          本文链接:https://www.haomeiwen.com/subject/adpklttx.html