今天更新Xcode8遇到了各種問題。
-
如果你是老版本請不要使用swift最近版.則是選擇2.3版本
-
注釋快捷鍵不能使用
- 命令后 輸入 sudo /usr/libexec/xpccachectl
- 記得一定要重啟機子后才有用
-
代理方式也需要更改
- 例如原來是xxx.delegate = self ;
- 現(xiàn)在需要修改成xxx.delegate = (id<CAAnimationDelegate>)self;
推送都需要重新配置
#######define isiOS10 ([[[[UIDevice currentDevice] systemVersion] substringToIndex:1] intValue]>=10)
這句話截取一位,ios10截取下來就是1.所以永遠會返回no.
#define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
#define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)
- 訪問相冊等隱私會閃退
- 要想解決這個問題,只需要在info.plist添加
- NSContactsUsageDescription的
- key, value自己隨意填寫就可以,這里列舉出對應的key
<!-- 相冊 --> <key>NSPhotoLibraryUsageDescription</key> <string>App需要您的同意,才能訪問相冊</string>
<!-- 相機 --> <key>NSCameraUsageDescription</key> <string>App需要您的同意,才能訪問相機</string>
<!-- 麥克風 --> <key>NSMicrophoneUsageDescription</key> <string>App需要您的同意,才能訪問麥克風</string>
<!-- 位置 --> <key>NSLocationUsageDescription</key> <string>App需要您的同意,才能訪問位置</string>
<!-- 在使用期間訪問位置 --> <key>NSLocationWhenInUseUsageDescription</key> <string>App需要您的同意,才能在使用期間訪問位置</string>
<!-- 始終訪問位置 --> <key>NSLocationAlwaysUsageDescription</key> <string>App需要您的同意,才能始終訪問位置</string>
<!-- 日歷 --> <key>NSCalendarsUsageDescription</key> <string>App需要您的同意,才能訪問日歷</string>
<!-- 提醒事項 --> <key>NSRemindersUsageDescription</key> <string>App需要您的同意,才能訪問提醒事項</string>
<!-- 運動與健身 --> <key>NSMotionUsageDescription</key> <string>App需要您的同意,才能訪問運動與健身</string>
<!-- 健康更新 --> <key>NSHealthUpdateUsageDescription</key> <string>App需要您的同意,才能訪問健康更新 </string>
<!-- 健康分享 --> <key>NSHealthShareUsageDescription</key> <string>App需要您的同意,才能訪問健康分享</string>
<!-- 藍牙 --> <key>NSBluetoothPeripheralUsageDescription</key> <string>App需要您的同意,才能訪問藍牙</string>
<!-- 媒體資料庫 --> <key>NSAppleMusicUsageDescription</key> <string>App需要您的同意,才能訪問媒體資料庫</string>
Xcode里選中 ->target ->Capabilities ->Background Modes.選擇對應權(quán)限.
SiriKit
在 iOS 10 中,我們只能用 SiriKit 來做六類事情,分別是:語音和視頻通話
發(fā)送消息
發(fā)送或接收付款
搜索照片
約車
管理健身
具體請看官方文檔通知
iOS 10 又新增了為通知添加音頻 圖片 甚至視頻的功能 現(xiàn)在 你的通知不僅僅是提醒用戶回到應用的入口 更成為了一個展示應用內(nèi)容 向用戶傳遞多媒體信息的窗口 也新增很多關(guān)于通知的api 現(xiàn)在基本與網(wǎng)絡(luò)請求一樣發(fā)送一個請求 然后得到服務器所返回的數(shù)據(jù)這類的
#import <UserNotifications/NSString+UserNotifications.h>
#import <UserNotifications/UNError.h>
#import <UserNotifications/UNNotification.h>
#import <UserNotifications/UNNotificationAction.h>
#import <UserNotifications/UNNotificationAttachment.h>
#import <UserNotifications/UNNotificationCategory.h>
#import <UserNotifications/UNNotificationContent.h>
#import <UserNotifications/UNNotificationRequest.h>
#import <UserNotifications/UNNotificationResponse.h>
#import <UserNotifications/UNNotificationSettings.h>
#import <UserNotifications/UNNotificationSound.h>
#import <UserNotifications/UNNotificationTrigger.h>
#import <UserNotifications/UNUserNotificationCenter.h>
#import <UserNotifications/UNNotificationServiceExtension.h>
- UIColor增加了兩個新的api
- rgb轉(zhuǎn)換顏色 建議用下面兩個方法
- (UIColor *)initWithDisplayP3Red:(CGFloat)displayP3Red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha NS_AVAILABLE_IOS(10_0);
+ (UIColor *)colorWithDisplayP3Red:(CGFloat)displayP3Red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha NS_AVAILABLE_IOS(10_0);
