views:

342

answers:

1

Application uses 3.x SDK feature, but needs to run in 2.x devices. The solution seems to be using "weak linking", which I did, but app still fails to * compile * for iPhone 2.2.1: "Framework not found MapKit".

Compile for target "Device 3.0 - Debug" is ok, even installs on my iPod Touch running 2.2.1! Runs ok as long as I don't activate view using MapKit, crashes if I do.

I created a view using Interface Builder, dragged a MkMapView object on it. As far as I can tell, this is the only reference to MapKit, so the question is: when I use weak linking, can I use related UI elements in IB at all? Should I do all of this in XCode only? Guess yes, but being able to install and run "3.0" app on "2.2.1" device confuses me...

+1  A: 

You should not load a nib file which contains 3.0 only objects like MKMapView on a 2.0 device. That means, you have to check from code the availability of the framework/classes you use in the nib. If they are not available, you must not load the nib.

This is how you can check if map kit is available:

if (NSClassFromString(@"MKMapView") != NULL) {
    // load nib, map kit is available
} else {
    // do something else, map kit is not there
}
Nikolai Ruhe