Fixing "Base SDK Missing" error with Xcode 3.2.5 and iOS SDK 4.2

If you just updated to Xcode 3.2.5 and iOS SDK 4.2, you might find that your existing projects do not compile. This probably doesn't surprise you as it's been the way for every SDK update as far back as the beginning of time (at least in the Jobsian calendar). Thankfully, with Xcode 3.2.5, you can set your base SDK once and for all and it should work for all future releases.

But first things, first, here's the error I received while trying to compile one of the early projects from my iOS SDK workshop: "error: there is no SDK with the name or path 'iphoneos4.1'"

Xcode error: there is no SDK with the name or path 'iphoneos4.1'

Also, when I looked under the Overview drop-down in Xcode, I noticed that the settings there were entirely wrong:

The overview drop-down showing the wrong settings.

To fix the Base SDK Missing error (once and for all), I opened up the Project Settings (Project &rarrow; Edit Project Settings) and, under the Build tab, set the Base SDK setting to "Latest iOS (currently set to iOS 4.2)".

Changing the Base SDK to the Latest iOS SDK in Project Settings.

Closing the Project Settings, however, did not update the Overview drop-down and I could only build for the device, not the simulator.

The overview drop-down after setting the SDK to the latest in the Project Settings, still showing the wrong information.

To fix this, I had to restart Xcode.

Update: You don't have to restart Xcode: closing the project and reopening it also fixes it. Thanks to Amar Kulo for the heads up.

After restarting Xcode, the Overview drop-down displayed the correct information and I was up and running again.

The overview drop-down after starting Xcode looks correct.

I hope this helps you if you encounter the same issue after upgrading to Xcode 3.2.5 and iOS SDK 4.2.

Happy coding!

Update: The core frameworks will also appear to be missing initially. This, too, will be fixed after you re-open the project so don't go through the effort of re-importing them.

Update: Also, if in 4.1, you added the iOS SDK 4.1 workaround for the CGPDFContext.h:60:23: error: expected function body after function declarator error, you need to remove this or you will get a warning: '__IPHONE_OS_VERSION_MIN_REQUIRED' macro redefined.

If you get this warning, check whether you added the -D__IPHONE_OS_VERSION_MIN_REQUIRED=040100 flag to the Other C Flags in Project Settings or whether you added the two defines listed in my blog post, above, in the Prefix.pch file for your project. Remove the flag and/or the defines to remove the warning.

Update: I also had thousands of warnings on a project that uses the Google Toolbox for Mac HTTP Fetcher and had the -Xclang -fobjc-nonfragile-abi2 flag set in the project (this allows you to skip @synthesize statements and implicitly creates the, umm, implicit accessors). Removing the compiler flag removed the 20,000 or so warnings also. For the record, I consider this a WIN.

Comments