[MonoTouch] Third argument Presentviewcontroller

Xy Xy at pyriformgroup.com
Mon Dec 19 03:21:07 EST 2011


Hi Robert,

How should the api be called to avoid the NSInvalidArgumentException below? Using null or delegate {} as the 3rd argument does NOT work.

On Dec 14, 2011, at 1:57 AM, Robert Jordan [via MonoTouch] wrote:

> Hi, 
> 
> you can check the iOS version at run-time: 
> 
> if (UIDevice.CurrentDevice.CheckSystemVersion (5, 0)) { 
>         // call API for iOS >= 5.0 
> } else { 
>         // alternative 
> } 
> 
> Robert 
> 
> On 14.12.2011 06:35, Xy wrote:
> 
> > Hi Robert, 
> > 
> > Would still be great if you could tell us how to call such a method 
> > correctly. There are other similar methods in iOS 5API, such as 
> > DismissViewController. We probably should start using them soon. 
> > 
> > Thanks, 
> > XY 
> > 
> > 
> > Robert Jordan wrote 
> >> 
> >> On 31.10.2011 20:25, Andreas Ploetzeneder wrote: 
> >>> i get 
> >>>    MonoTouch.Foundation.MonoTouchException: Objective-C exception thrown. 
> >>> Name: NSInvalidArgumentException Reason: -[S3G.MySplitViewController 
> >>> presentViewController:animated:completion:]: unrecognized selector sent 
> >>> to 
> >>> instance 0x72d3300 
> >> 
> >> This is an iOS 5 API. You want PresentModalViewController. 
> >> 
> >> Robert 
> >> 
> >> 
> >>> 
> >>> 2011/10/31 Robert Jordan<robertj@> 
> >>> 
> >>>> On 31.10.2011 19:56, Andreas Ploetzeneder wrote: 
> >>>>> null is not allowed,i get a crash if i make third argument null.... but 
> >>>> for 
> >>>>> what do i need it  ? 
> >>>> 
> >>>>      From the docs I've posted below: "The completion handler is called 
> >>>> after the viewDidAppear: method is called on the presented view 
> >>>> controller." 
> >>>> 
> >>>>> so third argument can be "delegate{};"? 
> >>>> 
> >>>> Yes. 
> >>>> 
> >>>> splitviewcontroller.PresentViewController( 
> >>>>     someController, 
> >>>>     true, 
> >>>>     delegate {} 
> >>>>     ); 
> >>>> 
> >>>>> 
> >>>>> 
> >>>>> 
> >>>>> 2011/10/31 Robert Jordan<robertj@> 
> >>>>> 
> >>>>>> On 31.10.2011 18:48, Andreas Ploetzeneder wrote: 
> >>>>>>> Hi, 
> >>>>>>> i want to call splitviewcontroller.PresentViewController  , 
> >>>>>>> splitviewcontroller is an UISplitviewcontroller 
> >>>>>>> 
> >>>>>>> what is the third argument, i have to call? can u show me an example? 
> >>>>>> 
> >>>>>> It's a simple delegate, so you could pass `delegate {}' as the 3rd 
> >>>>>> parameter, if null isn't allowed. The docs say otherwise: 
> >>>>>> 
> >>>>>> 
> >>>>>> 
> >>>> <a href="http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/doc/uid/TP40006926-CH3-SW75">http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/doc/uid/TP40006926-CH3-SW75
> >>>>>> 
> >>>>>> So please file a bug if passing delegate {} is fixing your issue. 
> >>>>>> 
> >>>>>> Robert 
> >>>>>> 
> >>>>>> 
> >>>>>> _______________________________________________ 
> >>>>>> MonoTouch mailing list 
> >>>>>> MonoTouch at .ximian 
> >>>>>> http://lists.ximian.com/mailman/listinfo/monotouch
> >>>>>> 
> >>>>> 
> >>>>> 
> >>>>> 
> >>>> 
> >>>> _______________________________________________ 
> >>>> MonoTouch mailing list 
> >>>> MonoTouch at .ximian 
> >>>> http://lists.ximian.com/mailman/listinfo/monotouch
> >>>> 
> >>> 
> >>> 
> >>> 
> >> 
> >> _______________________________________________ 
> >> MonoTouch mailing list 
> >> MonoTouch at .ximian 
> >> http://lists.ximian.com/mailman/listinfo/monotouch
> >> 
> > 
> > 
> > -- 
> > View this message in context: http://monotouch.2284126.n4.nabble.com/Third-argument-Presentviewcontroller-tp3956583p4193760.html
> > Sent from the MonoTouch mailing list archive at Nabble.com.
> 
> 
> _______________________________________________ 
> MonoTouch mailing list 
> [hidden email] 
> http://lists.ximian.com/mailman/listinfo/monotouch
> 
> 
> If you reply to this email, your message will be added to the discussion below:
> http://monotouch.2284126.n4.nabble.com/Third-argument-Presentviewcontroller-tp3956583p4194333.html
> To unsubscribe from Third argument Presentviewcontroller, click here.
> NAML



--
View this message in context: http://monotouch.2284126.n4.nabble.com/Third-argument-Presentviewcontroller-tp3956583p4213294.html
Sent from the MonoTouch mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/monotouch/attachments/20111219/444fc4ad/attachment.html 


More information about the MonoTouch mailing list