2

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).

Mihai Damian
  • 11,193
  • 11
  • 59
  • 81
  • Can you check to see if your scheme setup is the same for the simulator as it is for an iOS device? Could you have a different target under the iOS scheme which had a lower sdk then 5.0? – chown Nov 18 '11 at 14:56
  • Base SDK is always set to latest iOS (iOS 5). Notice that I *am* able to use other iOS 5 methods like UIViewController's childViewControllers. I have a feeling the problem seems to be only for the appearance methods (those marked with UI_APPEARANCE_SELECTOR). – Mihai Damian Nov 18 '11 at 15:01

1 Answers1

2

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.

Mihai Damian
  • 11,193
  • 11
  • 59
  • 81
  • 1
    Thanks man, it worked. BTW, Here's the path to the folder with all the SDKs: /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/ – Soonts Nov 29 '11 at 14:54