Tuesday, December 7, 2010

Missing Base SDK in existing projects when upgrading to Xcode 3.2.x

This article describes how to solve the problem of Missing Base SDK. This problem happend to me after updating to Xcode 3.2.5. While researching I saw that few people had this problem also with Xcode 3.2.3 and 3.2.4. This fix should work for any of the above versions.

Downpoint for Xcode 3.2.5 is that only IOS 4.2 is supported furthermore. I will soon describe in another article how to set Xcode 3.2.4 and 3.2.5 in parallel up on your system to use older SDKs as well.

To perform the steps described below open the according project in Xcode.

1. Change the SDK of the project

1. From the Xcode menu bar, select Project > Edit Project Settings
2. Select the "Build tab"
3. Select "All Configurations" under "Configurations"
4. Under Architecture > Base SDK, choose depending on what is available the according iOS SDK (for Xcode 3.2.5 iOS 4.2)

2. Change the SDK of the target

1. Make sure the right target is selected. In the menu bar top of the screen, select Project > Active Target > "DesiredTarget"
2. From the menu, select Project > Edit Active Target "DesiredTarget"
3. Select the "Build" tab
4. Select "All Configurations" under "Configurations"
5. Under Architecture > Base SDK, choose depending on what is available the according iOS SDK (for Xcode 3.2.5 iOS 4.2)

3. Support older iOS versions

If you want to support previous iOS versions, when you perform the steps under 1. and 2. in the same windows, under Deployment > iPhone OS Deployment Target, select the lowest version you want to support. Support for iPhone OS 2.x versions is deprecated for apps through the app store.

Friday, December 3, 2010

Xcode Linking Problem: symbol(s) not found

The discussed problem

For my recent iPhone Xcode Cocoa project I setup mogenerator to autamtically get the classes created that match an entity in the xcdatamodel. When I later tried to use those objects in my ViewControllers I couldn't get the application build.

The error said something a long the lines:

Undefined symbols:
   "_OBJC_CLASS_$_Recipes", referenced from:
       objc-class-ref-to-Recipes in RootViewController.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

Whereas "Recipes" stands for one of my entities in my CoreData datamodel.

The fix of the linking error

It took me hours to figure this one out. In XCode if you click on your project root in the Groups & Files View (normally on the left of the XCode window), you can see (on the right hand side of the XCode window) the list of all files in the project. As you can see below in the picture.

Make sure that in the last column of the list for each .m file (especially for the once that caused the error) the box is checked. If the box is checked the file is included in the default target that gets build.

The reasons for linking errors

If you never change anything in the target files and/or related build configuration, all your new classes should be included in the build of the target automatically.

The file that caused my error was generated with the mogenerator. The generator creates a subfolder in your Xcode project and it seems to me like all the files in there are not automatically added to the target.