简体   繁体   中英

XCode5 Error: “use of undeclared identifier uistatusbarstylelightcontent” iOS6 deployment

I've been working on a project where the deployment target is iOS 6 but the Build Settings/Base SDK is iOS 7. I was returning UIStatusBarStyleLightContent from (UIStatusBarStyle)preferredStatusBarStyle and the project was compiling.

I tried wrapping the offending code in compiler #if statements like this:

- (UIStatusBarStyle)preferredStatusBarStyle 
{ 
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000
    return UIStatusBarStyleLightContent;'
#else
    return UIStatusBarStyleBlackTranslucent;
#endif
}

But then I got the same error for other identifiers like 'tintColor' and 'cornerRadius' for CALayers.

Initially I was searching for an accidentally changed project setting, but I couldn't find any and my .xcuserdata is in my git ignore file. I added the iOS 6.1 SDK to my XCode 5 installation to compile another test app to my iOS 6 test device last night, so I tried removing that folder from XCode 5's library. Even though I wasn't explicitly targeting the iOS 6 SDK (it was my Deployment Target not Base SDK) XCode was looking at my code as if it was iOS 6 and throwing errors for all my iOS 7 code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM