我試圖清除,因爲在更新到iOS 9.0我的應用程序的所有的警告,我試圖做到這一點:不同的代碼仍然顯示警告
#if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_0
// less than iOS 9.0
- (NSUInteger)supportedInterfaceOrientations
{
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
return UIInterfaceOrientationMaskPortrait;
} else {
return UIInterfaceOrientationMaskAll;
}
}
#else
// iOS 9.0 or later
- (UIInterfaceOrientationMask)supportedInterfaceOrientations
{
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
return UIInterfaceOrientationMaskPortrait;
} else {
return UIInterfaceOrientationMaskAll;
}
}
#endif
但我我仍然得到所有的警告,我做錯了什麼?
我發現這條指令在iOS 8.0和iOS 7.0中無法正常工作。
- (UIInterfaceOrientationMask)supportedInterfaceOrientations
它們不相同。返回類型是不同的。 – rmaddy