Hi sebastien and thanks for your response, im a new with unit test
could you elaborate or point me on how to implement this?

Sounds really helpful

Alex

El 28/08/2012, a las 07:59 a.m., Sebastien Pouliot
<sebast...@xamarin.com> escribió:

> To avoid duplication: http://stackoverflow.com/q/12155558/220643
>
> Sebastien
>
> On Mon, Aug 27, 2012 at 10:03 AM, René Ruppert <rene.rupp...@gmail.com> wrote:
>> Hi,
>>
>> sorry, I don't understand at all why this is happening. If the
>> UIPopoverController is working without subclassing, it should also work with
>> subclassing - after all, the base c'tor is getting called!? I'm totally
>> puzzled.
>> I can subclass any UIViewController in MonoTouch without issue, why not that
>> one? Why it that popover NULL?
>>
>> René
>>
>>
>> 2012/8/27 Alex Soto <dxdr...@gmail.com>
>>>
>>>
>>>
>>> Ok, if you subclass you need to implement all methods and properties
>>> needed, and how to know whats needed ?? You need too look at original ObjC
>>> code in this case (thank God it is very well documented) you need to see
>>> PSPDFViewController.h, you can find it inside PSPDFKitExample xcode project
>>>
>>> /// Saves the popoverController if currently displayed.
>>> @property(nonatomic, strong) UIPopoverController *popoverController;
>>>
>>> Unfortunately it doesn't mention that popoverController can be nil or null
>>> in c# world so it must be implemented
>>>
>>> The error its showing you in this case ,this is the key part of the error
>>>
>>> System.ArgumentNullException: Argument cannot be null.
>>> Parameter name: value
>>>  at AlexTouch.PSPDFKit.PSPDFViewController.set_PopoverController
>>> (MonoTouch.UIKit.UIPopoverController value) [0x00000] in <filename
>>> unknown>:0
>>>
>>>
>>> There is a property PopoverController that cannot be null, you should be
>>> fine doing
>>>
>>> var oController = new SubclassedController(oDoc)
>>> {
>>> ModalPresentationStyle =
>>> MonoTouch.UIKit.UIModalPresentationStyle.FullScreen,
>>> ModalTransitionStyle =
>>> MonoTouch.UIKit.UIModalTransitionStyle.CoverVertical,
>>>
>>> PopoverController = new PopoverController();
>>>
>>> } ;
>>>
>>>
>>> I hope this helps, and also I hope I have explained myself hehe.
>>>
>>> Alex
>>>
>>>
>>>
>>>
>>> El 27/08/2012, a las 07:31, René Ruppert <rene.rupp...@gmail.com>
>>> escribió:
>>>
>>> Hi,
>>>
>>> If I use this code, everything is fine. I just call
>>> PdfViewerController2.ShowModally(). In there, you see a part that is
>>> commented out. If I use that subclass instead of PSPDFViewController
>>> directly, it fails and I get the exception below.
>>> Can somebody please explain what is going on? The PSPDFViewController is
>>> coming from a bound library.
>>>
>>> public class SubclassedController : PSPDFViewController
>>> {
>>> private SubclassedController (PSPDFDocument oDoc) : base(oDoc)
>>> {
>>> }
>>>
>>> public static void ShowModally(string sFilename)
>>> {
>>> PSPDFDocument oDoc = new PSPDFDocument(NSUrl.FromFilename(sFilename));
>>>
>>> // This is working.
>>>                        var oController = new PSPDFViewController(oDoc)
>>>
>>> {
>>> ModalPresentationStyle =
>>> MonoTouch.UIKit.UIModalPresentationStyle.FullScreen,
>>> ModalTransitionStyle =
>>> MonoTouch.UIKit.UIModalTransitionStyle.CoverVertical
>>> } ;
>>>
>>>
>>>
>>>                        // This isn't!
>>>                        /*var oController = new SubclassedController(oDoc)
>>> {
>>> ModalPresentationStyle =
>>> MonoTouch.UIKit.UIModalPresentationStyle.FullScreen,
>>> ModalTransitionStyle =
>>> MonoTouch.UIKit.UIModalTransitionStyle.CoverVertical
>>> } ;*/
>>>
>>> AppDelegateBase.BaseAppDelegate.MainController.PresentViewController(oController,
>>> true, delegate {} );
>>> }
>>> }
>>>
>>> {System.ArgumentNullException: Argument cannot be null.
>>> Parameter name: value
>>>  at AlexTouch.PSPDFKit.PSPDFViewController.set_PopoverController
>>> (MonoTouch.UIKit.UIPopoverController value) [0x00000] in <filename
>>> unknown>:0
>>>  at (wrapper managed-to-native)
>>> MonoTouch.ObjCRuntime.Messaging:void_objc_msgSendSuper (intptr,intptr)
>>>  at AlexTouch.PSPDFKit.PSPDFViewController.ReloadData () [0x00000] in
>>> <filename unknown>:0
>>>  at (wrapper managed-to-native)
>>> MonoTouch.ObjCRuntime.Messaging:void_objc_msgSendSuper_IntPtr_bool_IntPtr
>>> (intptr,intptr,intptr,bool,intptr)
>>>  at MonoTouch.UIKit.UIViewController.PresentViewController
>>> (MonoTouch.UIKit.UIViewController viewControllerToPresent, Boolean animated,
>>> MonoTouch.Foundation.NSAction completionHandler) [0x0006a] in
>>> /Developer/MonoTouch/Source/monotouch/src/UIKit/UIViewController.g.cs:482
>>>  at BrainloopMobile.PdfViewer.PdfViewerController2.ShowModally
>>> (System.String sFilename) [0x00023] in
>>> /Users/rene/Documents/Develop/Projects/BrainloopMobile/220/BrainloopMobile/BrainloopMobile/Controllers/PdfViewer/PdfViewerController2.cs:22
>>>  at BrainloopMobile.ProgressPreviewItem.PreviewPDF () [0x00000] in
>>> /Users/rene/Documents/Develop/Projects/BrainloopMobile/220/BrainloopMobile/BrainloopMobile/Progress/ProgressPreviewItem.cs:446
>>>  at BrainloopMobile.ProgressPreviewItem.ProgressEnded () [0x001d0] in
>>> /Users/rene/Documents/Develop/Projects/BrainloopMobile/220/BrainloopMobile/BrainloopMobile/Progress/ProgressPreviewItem.cs:428
>>>  at BrainloopMobile.Progress.ProgressDelegate.BaseProgressEnded
>>> (PROGRESS_STATUS eStatus) [0x00007] in
>>> /Users/rene/Documents/Develop/Projects/BrainloopMobile/220/BrainloopMobile/BrainloopMobile/Progress/Base/ProgressDelegate.cs:55
>>>  at
>>> BrainloopMobile.Progress.ModalProgressController+<EndProgress>c__AnonStorey3A.<>m__B3
>>> () [0x0004c] in
>>> /Users/rene/Documents/Develop/Projects/BrainloopMobile/220/BrainloopMobile/BrainloopMobile/Progress/Base/ModalProgressController.cs:422
>>>  at MonoTouch.UIKit.UIView+<Animate>c__AnonStorey12.<>m__14 (Boolean x)
>>> [0x0000b] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIView.cs:110
>>>  at MonoTouch.UIKit.UIView.TrampolineUICompletionHandler (IntPtr block,
>>> Boolean finished) [0x00053] in
>>> /Developer/MonoTouch/Source/monotouch/src/UIKit/UIView.g.cs:1604
>>>  at (wrapper native-to-managed)
>>> MonoTouch.UIKit.UIView:TrampolineUICompletionHandler (intptr,int)
>>>  at (wrapper managed-to-native)
>>> MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
>>>  at MonoTouch.UIKit.UIApplication.Main (System.String[] args,
>>> System.String principalClassName, System.String delegateClassName) [0x00042]
>>> in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:29
>>>  at BrainloopMobile.Application.Main (System.String[] args) [0x00000] in
>>> /Users/rene/Documents/Develop/Projects/BrainloopMobile/220/BrainloopMobile/BrainloopMobile/Main.cs:15
>>> }
>>>
>>> René
>>
>>
>> _______________________________________________
>> MonoTouch mailing list
>> MonoTouch@lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/monotouch
>>
_______________________________________________
MonoTouch mailing list
MonoTouch@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to