iOS 10 / Xcode 8 問題彙總
執行時會出現類似 subsystem: com.apple.UIKit, category: HIDEventFiltered…… 的一大串日誌。
解法:【Product】-【Scheme】-【Edit Scheme】-【Run】-【Arguments】-【Environment Variable】加入 key-value【OS_ACTIVITY_MODE disable】,即可停止輸出該日誌。
遺留問題:還可能出現 Class PLBuildVersion is implemented in both…… One of the two will be used. Which one is undefined 的提示。

解法:在類庫中加入範圍判斷。
if (range.location != NSNotFound) {
language = [language substringToIndex:range.location];
}
label 的話可以寫一個擴展類。
@implementation UILabel (Extend)
- (void)lableAdaptIOS10{
CGFloat iOS10 = [[UIDevice currentDevice] systemVersion].floatValue >= 10;
if (iOS10) {
// self UIFont 的 preferredFontForTextStyle: 意思是指定一個樣式,並讓字體大小符合用戶設定的字體大小。
[self sizeToFit];
// self.font =[UIFont preferredFontForTextStyle: UIFontTextStyleHeadline]; //是否更新字體的變化
// self.adjustsFontForContentSizeCategory = YES;
}
}
<1> Xcode 打開 SB 頻繁崩潰;
<2> Xcode 打開 SB 後約束出現大量警告 ⚠️。
打開終端執行:sudo /usr/libexec/xpccachectl,然後重啟電腦。
出現 This version does not support documents saved in the Xcode 8 format. Open this document with Xcode 8.0 or later. 的提示。

刪除 SB 中對應的程式碼即可。

#ifdef DEBUG
#define HYString [NSString stringWithFormat:@"%s", __FILE__].lastPathComponent
#define HYLog(...) printf("%s 第%d行: %s\n\n", [HYString UTF8String] ,__LINE__, [[NSString stringWithFormat:__VA_ARGS__] UTF8String]);
#else
#define HYLog(...)
#endif
以上便是本文的全部內容,希望對大家的學習有所幫助。