I have a line of code:
this.NavigationItem.LeftBarButtonItems = new UIBarButtonItem[] { btnRefresh,btnCalculator};
Works fine on iPads above OS 4.3.5 , but OS 4.3.5 throws this strange error for “some” of my users. I can’t replicate, but have had it reported to me several times:
[UINavigationItem setLeftBarButtonItems:]: unrecognized selector sent to instance 0x86bf20
UIKitApplication:com.ianvink.ref.goldsilver[0x99bd][121]
Unhandled Exception: MonoTouch.Foundation.MonoTouchException:
Objective-C exception thrown. Name: NSInvalidArgumentException
Reason: -[UINavigationItem setLeftBarButtonItems:]: unrecognized selector sent to instance 0x86bf20
UIKitApplication:com.ianvink.ref.goldsilver[0x99bd][121] <Notice>:
at MonoTouch.UIKit.UINavigationItem.set_LeftBarButtonItems
(MonoTouch.UIKit.UIBarButtonItem[] value) [0x00000] in <filename unknown>:0
Is there a work around in this case?
This property (the ObjectiveC selector to be precise) was added in iOS 5.0. It won’t work in earlier iOS releases.
You can fallback to
LeftBarButtonItemwhich, limited to 1 button, is available since iOS 2.0.