关于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

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 发现 关注 消息 iOS 第三方库、插件、知名博客总结 作者大灰狼的小绵羊哥哥关注 2017.06.26 09:4...
    肇东周阅读 12,232评论 4 61
  • 俗话说得好,“穷不过三代,富不过五服”。 我很喜欢这句话,因为它可以很好地解释我现在穷的原因,为什么呢?因为我家族...
    露露儿Lucy阅读 382评论 2 4
  • 俞敏洪的演讲《人与人的差距是怎么拉开的》? 有的人一辈子浑浑噩噩生活,没有创造成就,没有为家庭带来收益,为国家做出...
    SeventhBoaers阅读 227评论 0 0