Trouble using barButtonItem for popoverPresentationController in iOS 9? -


i've had code using new uialertcontroller class that's been working fine in ios 8. crashes in ios 9, following error message:

2015-07-23 10:38:27.499 myapp[828:563509] -[uitabbaritem _viewforpresenting]: unrecognized selector sent instance 0x157644960 2015-07-23 10:38:27.500 myapp[828:563509] *** terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[uitabbaritem _viewforpresenting]: unrecognized selector sent instance 0x157644960' 

the problem seems using barbuttonitem field configure popoverpresentationcontroller, instead of using sourceview/sourcerect thing. if switch latter, it's fine (but of course, action sheet doesn't pop wanted pop up). googling error message has come blank far.

here code. it's pretty basic, nothing fancy going on here:

    uialertcontroller *alertcontroller = [uialertcontroller alertcontrollerwithtitle:@"what want do?" message:nil preferredstyle:uialertcontrollerstyleactionsheet];     [alertcontroller addaction:[uialertaction actionwithtitle:@"clear call history" style:uialertactionstyledestructive handler:^(uialertaction *action) {         [self confirmclearcallhistory];     }]];     [alertcontroller addaction:[uialertaction actionwithtitle:@"cancel" style:uialertactionstyledefault handler:^(uialertaction * action) {}]];     [alertcontroller setmodalpresentationstyle:uimodalpresentationpopover];      //if (like want to), crashes:     [alertcontroller popoverpresentationcontroller].barbuttonitem = self.tabbarcontroller.callstab;      // if this, it's fine:     // [alertcontroller popoverpresentationcontroller].sourceview = self.editbutton;     //  [alertcontroller popoverpresentationcontroller].sourcerect = self.editbutton.bounds;      [self presentviewcontroller:alertcontroller animated:yes completion:nil]; 

anybody else had similar issues? it's same in 3 ios 9 betas far...

(oh, , should mention crashes on ipad, not on iphone... that's not surprising, because presentation mode action sheet no-op on iphone, i.e. action sheets presented same no matter what)

oh, interesting. i'm passing uitabbaritem instance barbuttonitem field. (i inherited older code, wasn't aware of this) somehow, worked on ios 8? go figure.

so yeah, can't guess. heh.


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -