一、iOS9中被移除的API或者枚举
CoreImage CIImage.h :
autoAdjustmentFilters —removed
Fondation NSKeyedArchiver.h :
Removed -[NSKeyedArchiver setRequiresSecureCoding:]
Removed -[NSKeyedUnarchiver setRequiresSecureCoding:]
Fondation NSURLSession.h :
Removed -[NSURLSession dataTaskWithHTTPGetRequest:]
Removed -[NSURLSession dataTaskWithHTTPGetRequest:completionHandler:]
Removed -NSURLSession(NSURLSessionDeprecated)
UIKit NSAttributedString.h :
Removed NSMutableAttributedString(NSMutableAttributedStringKitAdditions)
UIKit UITabBarItem.h :
Removed -[UITabBarItem setTitlePositionAdjustment:]
UIKit UIView.h :
Removed -[UIView setTranslatesAutoresizingMaskIntoConstraints:]
CBCentralManager :
Removed retrievePeripherals:
Removed retrieveConnectedPeripherals
二、iOS9中一些方法的返回类型从id类型变成了具体的instantType,所以调用方法时需要注意返回类型。比如:
- (id)objectAtIndexedSubscript:(NSUInteger)idx
To
- (ObjectType _Nonnull)objectAtIndexedSubscript:(NSUInteger)idx
返回类型被修改为必须返回不能为空的ObjectType。
三、iOS9 中增加了对泛型的支持,指定了容器内的元素类型,所以如果容器内含有其他类型的元素,可能会报错(具体没试验,不知道会不会),比如
- (void)setEntities:(NSArray *)entities forConfiguration:(NSString *)configuration
To
- (void)setEntities:(NSArray<NSEntityDescription *> * _Nonnull)entities forConfiguration:(NSString * _Nonnull)configuration
第一个参数就修改为了泛型,NSArray中指定元素类型为NSEntityDescription。
四、iOS9中很多参数或者属性都增加了nullable 、nonnull关键字分别表示,该参数或属性“可以为空”和“不能为空”。
五、canOpenURL:和openURL:这两个API在iOS9中受到影响,当用xcode7打包时需要在plist文件中配置参数。(LSApplicationQueriesSchemes)
六、关于HTTP改为HTTPS的影响。(已改)
七、iOS 9中,UIPickerView和UIDatePicker的宽在所有设备上的默认宽度设为320,需要注意