Question

Not true for all new iOS 5 methods but I've found out that calling UINavigationBar's setBackgroundImage:forBarMetrics: method will trigger an 'instance method not found' warning if the deployment target is under 5.0. This is even though I am linking with the SDK 5.0.

More importantly the enum UIBarMetrics used as a parameter there is reported as an 'undeclared identifier' and this will trigger a compiler error.

Any idea why this is so? I realized the code will not work if the deployment target is under 5.0 but I'm checking if UINavigationBar responds to that selector at run time, so everything should be ok. I don't understand the compiler error though.

EDIT: This only happens when compiling for a device, and when a device is actually plugged in (the device I've tested with runs iOS 5.0.1).

Was it helpful?

Solution

Well, I figured out the mystery. I manage to fix the problem by deleting SDK 4.3 (I had that one copied over from Xcode 3 since it doesn't come by default with the latest Xcode+SDK package and I was using it for another legacy project).

I still can't explain why having both SDKs caused the error since I was clearly compiling with the latest SDK.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top