Ian Vink
Ian Vink

Reputation: 68750

MonoTouch: Unrecognized Selector in iOS 4.3.1 iPad

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?

Upvotes: 1

Views: 474

Answers (2)

poupou
poupou

Reputation: 43553

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 LeftBarButtonItem which, limited to 1 button, is available since iOS 2.0.

Upvotes: 4

Related Questions