Entries in xcode (1)

Sunday
Jul042010

Updating an iPhone OS 3.x project (w/ AdMob integrated) to build for iOS 4.0, using Xcode 3.2.3

Looking to add a couple of features (save/resume) to an old project, I immediately hit issues building in Xcode 3.2.3, specifically:

  • AdMob libraries don't support the 4.0 OS Simulator (errors such as "".objc_class_name_UILabel", referenced from: .objc_class_name_AdMobLabelView in libAdMobSimulator.a(AdMobLabelView.o)")
  • Xcode 3.2.3 doesn't include the 3.x Base SDKs (you'll get a message somewhat like "error: There is no SDK with the name or path 'iphoneos3.0'")

So, addressing the above in reverse order:

  • Change the Base SDK for the project to 4.0
  1. Go to project info (right tap Project name in Organizer, Get Info)
  2. Ensure Configuration is set to "All Configurations" and Show is set to "All Settings"
  3. In the Architectures group, change Base SDK to iPhone Device 4.0
  4. Check that the iPhone OS Deployment Target is set to "iPhone OS 3.0" in the Deployment group
  • Check the Base SDK and Deployment Target settings for the project's target (Organizer > Targets > {target name}) using the same method as for the project itself

For information about the difference between Base SDK and Deployment Target, read this superb article at clarckcox.com.

  • Update the AdMob libraries

We were using a programmtic ad view controller, so needed to not only pull in a new copy of the admob SDK, but also update our own view controller.

  1. Remove any existing admob libraries (for this project it was all just in the admob folder, but depending on the library version you were using, you may also need to remove and update the TouchJSON library)
  2. Download the latest admob SDK - to do so:
    - go to http://www.admob.com/my_sites/
    - hover over the application in question and choose "Manage Settings"
    - Hit "Get Publisher Code" in the top section
    - Hit "Download AdMob iPhone SDK"
  3. Copy into your project the admob folder (removing AdMobInterstitial* - unless you use them / are approved for them)
  4. Copy into your project the TouchJSON folder (unless you're already using TouchJSON for other libraries - in which case you may need to update and test carefully)
  5. Update your programmatic ad view controller to include currentViewControllerForAd: if it's not included already (this required method was introduced after we originally incorporated the older admob library - approx February '10) - if you don't have it, you can just add:
    - (UIViewController *)currentViewControllerForAd:(AdMobView *)adView {
     return self;
    }

Done - 71 build errors to 0 and compatibility with (native compile against) 4.0, whilst maintaining compatibility with 3.x devices.