IOS8与IOS9不同点

苹果更新了ios9有一段时间了,最近总结了一下平时项目中遇到的一些ios9适配问题,分析一下ios8与ios9的不同点:

1. App Transport Security Settings

即NSAppTransportSecurity,IOS9中为了加强为了强制增强数据访问安全,默认会把 HTTP 请求,都改为 HTTPS 请求,原来的HTTP协议传输都改成TLS1.2协议进行传输,直接造成的情况就是App发请求的时候弹出网络无法连接。解决办法就是在项目的info.plist 文件里自己输入如下节点:





然后自己更新Xcode7.3后发现苹果更新成如下:


2. URLscheme

在iOS9中,如果使用URL scheme必须在"Info.plist"中将你要在外部调用的URL scheme列为白名单,否则不能使用。key叫做LSApplicationQueriesSchemes ,键值内容是

1
LSApplicationQueriesSchemes urlscheme1 urlscheme2 urlscheme3 urlscheme4

推荐一篇博客: http://awkwardhare.com/post/121196006730/quick-take-on-ios-9-url-scheme-changes

其中最关键的是以下部分:

1
2
If you call the “canOpenURL” method on a URL that is not  in  your whitelist, it will  return  “NO”, even  if  there is an app installed that has registered to handle  this  scheme. A “This app is not allowed to query  for  scheme xxx” syslog entry will appear.
If you call the “openURL” method on a URL that is not  in  your whitelist, it will fail silently. A “This app is not allowed to query  for  scheme xxx” syslog entry will appear.

3.statusbar

以前我们为了能够实时的控制顶部statusbar的样式,可能会在喜欢使用

[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];

[[UIApplication sharedApplication]setStatusBarHidden:YES];

但是这么做之前需要将 info.plist 里面加上View controller-based status bar appearance BOOL值设为NO,就是把控制器控制状态栏的权限给禁了,用UIApplication来控制。

但是这种做法在iOS9不建议使用了,建议我们使用把那个BOOL值设为YES,然后用控制器的方法来管理状态栏比如。

- (UIStatusBarStyle)preferredStatusBarStyle{

    return UIStatusBarStyleLightContent;

}

4.字体

iOS9中,中文系统字体变为了专为中国设计的“苹方”,字体有轻微的加粗效果,并且最关键的是字体间隙变大了!
所以很多原本写死了width的label可能会出现“...”的情况。
包括在很多时候我们自动计算行高行宽的时候出现偏差,导致一些不可知的错误

CGSize size = [title sizeWithAttributes:@{NSFontAttributeName: [UIFont systemFontOfSize:14.0f]}];

CGSize adjustedSize = CGSizeMake(ceilf(size.width), ceilf(size.height));


5.NSURLConnection

/*** DEPRECATED: The NSURLConnection class should no longer be used.  NSURLSession is the replacement for NSURLConnection ***/

IOS9后, 苹果用NSURLSession替代了NSURLConnection。如果项目以前使用过这些API,建议立即升级到基于 NSURLsession 的API的AFNetworking的版本。

6.bitcode

bitcode的理解应该是把程序编译成的一种过渡代码,然后苹果再把这个过渡代码编译成可执行的程序。bitcode也允许苹果在后期重新优化我们程序的二进制文件,有类似于App瘦身的思想。问题的原因是:某些第三方库还不支持bitcode,要不就是把这个bitcode禁用。

解决方法方法一:更新library使包含Bitcode,否则会出现以下中的警告;

1
( null ): URGENT: all bitcode will be dropped because  '/Users/myname/Library/Mobile Documents/com~apple~CloudDocs/foldername/appname/GoogleMobileAds.framework/GoogleMobileAds(GADSlot+AdEvents.o)'  was built without bitcode. You must rebuild it  with  bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode  for  this  target. Note: This will be an error  in  the future.

解决方法方法二:把这个bitcode设为禁用



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值