iOS 系統升級 (如 iOS 5 → iOS 6/7/...) 極少導致現有 App 崩潰或功能失效。Apple 極其重視向後兼容,已發布 App 繼續在新系統運行。
| 類別 | 表現 | 應對 |
|---|---|---|
| API 廢棄 | Xcode 編譯時出現黃色警告:'method' is deprecated | 按警告提示遷移至新 API,舊 API 繼續工作 |
| 外觀變化 | 導航欄、TabBar、控件樣式隨系統風格更新 (iOS 7 扁平化、iOS 13 深色模式) | 適配新設計規範,或鎖定舊外觀 (不推薦長期) |
| 權限機制 | 新增隱私權限彈窗 (定位、相機、麥克風、相冊、藍牙、語音識別...) | Info.plist 添加對應 UsageDescription,運行時請求授權 |
| 後台運行 | 後台任務限制收緊 (iOS 13+ BackgroundTasks 框架) | 遷移至 BGProcessingTask / BGAppRefreshTask |
| 架構變化 | 32 位設備支持移除 (iOS 11)、UIWebView 棄用 (iOS 12)、Bitcode 要求 | 架構設置包含 arm64、遷移至 WKWebView |
Product → Analyze 檢測廢棄 API、內存洩漏、邏輯錯誤-Wdeprecated-declarations (默認開啟),升級 Xcode 後重新編譯查看新警告
// iOS 7: 扁平化 UI
// navigationBar.translucent = YES → navigationBar.isTranslucent = true
// iOS 8: UISplitViewController 改變、UIAlertController 替代 UIAlertView/UIActionSheet
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Title" message:@"Msg" preferredStyle:UIAlertControllerStyleAlert];
// iOS 9: App Transport Security (ATS) 強制 HTTPS
// Info.plist: NSAppTransportSecurity -> NSAllowsArbitraryLoads (暫時) / 域名白名單 (正式)
// iOS 10: 隱私權限強制 UsageDescription
// Info.plist: NSCameraUsageDescription, NSLocationWhenInUseUsageDescription 等
// iOS 11: 32位支持移除、UIWebView 棄用、Safe Area 適配
// 建築設置: Architectures = arm64 (移除 armv7/armv7s)
// iOS 13: 深色模式、SceneDelegate、Sign in with Apple
// 支持深色: 色彩資產集合 + traitCollectionDidChange
// iOS 14: 本地網絡權限、App Tracking Transparency (ATT)
// Info.plist: NSLocalNetworkUsageDescription, NSUserTrackingUsageDescription
IPHONEOS_DEPLOYMENT_TARGET (建議 iOS 13+)