iOS9跨应用链接需要设置白名单

问题描述:今天输入法适配iOS9,发现分享都不能用了

问题分析
因为是跨应用链接,怀疑和iOS9的新安全机制有关
Log报错:2015-07-09 16:49:31.546 BaiduInputMethodContainer[339:27725] -canOpenURL: failed for URL: "sinaweibo://" - error: "(null)"

问题解决
在info.plist中,加入:

<key>LSApplicationQueriesSchemes</key>
<array>
<string>sinaweibo</string>
</array>

 

 

iOS9 beta2在iPad横屏下UITableView位置不正确

问题描述:设置项适配iOS9的时候发现UITableView的所有在iPad横屏下两边着很大的空白,如下图
TableViewDemo

问题分析
1.用UI视图看了下。UITableViewCell撑满整个屏幕是正确的。UITableViewCell的ContentView也是正确的。TextLabel不正确,你只能通过强行给TextLabel一个约束来修正。
2.设置了所有有关间距的属性,代码如下:
cell.indentationLevel=0;
cell.indentationWidth=0;
cell.separatorInset=UIEdgeInsetsZero;
cell.layoutMargins=UIEdgeInsetsZero;
cell.contentView.preservesSuperviewLayoutMargins=NO;
cell.preservesSuperviewLayoutMargins=NO;

tableView.contentInset=UIEdgeInsetsZero;
tableView.scrollIndicatorInsets=UIEdgeInsetsZero;
tableView.separatorInset=UIEdgeInsetsZero;
tableView.layoutMargins=UIEdgeInsetsZero;

[cell setNeedsLayout];
[cell setNeedsDisplay];
[cell layoutIfNeeded];

[tableView setNeedsLayout];
[tableView setNeedsDisplay];
[tableView layoutIfNeeded];
3.以上代码无效后,单独做了一个Demo:只放一个UITableView进去,问题同样存在,如下
TableViewDemo

问题结论
估计是iOS9 beta2的bug

环境:iPad Air2,iOS9 beta2,Xcode7.0 beta (7A120f)

iOS9默认网络访问都是SSL

问题描述:今天输入法适配iOS9,发现所有网络都不能访问了

问题分析
1.做了一个Demo,发现可以访问网络,访问的是http://www.baidu.com
2.调试设置项,发现所有返回的错误为“Error Domain=NSURLErrorDomain Code=-1200 "发生了 SSL 错误,无法建立与该服务器的安全连接。"”
3.把访问链接复制到浏览器中访问,发现有返回数据
4.仔细研究了一下错误发现所有的访问链接都变成了https://
5.在demo中证实所有iOS9会自动以SSL的方式访问所有网络链接

问题解决
在info.plist中,加入:

<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>yourserver.com</key>
<dict>
<!--Include to allow subdomains-->
<key>NSIncludesSubdomains</key>
<true/>
<!--Include to allow HTTP requests-->
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
<!--Include to specify minimum TLS version-->
<key>NSTemporaryExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
</dict>
</dict>
</dict>

或者你希望所有都打开TLS,可以这样写:

NSAppTransportSecurity

<!--Include to allow all connections (DANGER)-->
NSAllowsArbitraryLoads

 

PS:官方文档:https://developer.apple.com/library/prerelease/ios/technotes/App-Transport-Security-Technote/