0
votes

The application uses a 3.x SDK feature, but it needs to run in 2.x devices. The solution seems to be using "weak linking", which I did, but the 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! It runs OK as long as I don't activate view using MapKit and crashes if I do.

I created a view using Interface Builder (IB), 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
Nobody knows? Too easy question? Too difficult? Am I trying to do this thing in a "wrong" way, is this something that just shouldn't be done with IB? - JOM

1 Answers

2
votes

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
}