Hi all
I have made a application to show a PDF document, I follow an internet
examples but the app crashes after few milliseconds after shown the
document.
Below the source code:
NSUrl ns = NSUrl.FromFilename(s);
UIDocumentInteractionController PreviewController =
UIDocumentInteractionController.FromUrl(ns);
PreviewController.Delegate = new
MxUIDocumentInteractionControllerDelegateClass(MxSession.LoadedViewsCollection[MxViewType.ProductDetails].Instance);
PreviewController.PresentPreview(false);
public class MxUIDocumentInteractionControllerDelegateClass :
UIDocumentInteractionControllerDelegate
{
private UIViewController mViewController;
//private DTSVirtualFile mFile;
public MxUIDocumentInteractionControllerDelegateClass(UIViewController
viewController)
{
mViewController = viewController;
//mFile = file;
}
public override UIViewController ViewControllerForPreview
(UIDocumentInteractionController controller)
{
return mViewController;
}
public override UIView ViewForPreview (UIDocumentInteractionController
controller)
{
return mViewController.View;
}
public override RectangleF RectangleForPreview
(UIDocumentInteractionController controller)
{
return mViewController.View.Frame;
}
public override void DidEndPreview (UIDocumentInteractionController
controller)
{
Console.WriteLine ("WillBeginPreview");
}
public override void DidDismissOptionsMenu
(UIDocumentInteractionController controller)
{
// TODO: Implement - see:
http://go-mono.com/docs/index.aspx?link=T%3aMonoTouch.Foundation.ModelAttribute
}
public override void WillBeginPreview (UIDocumentInteractionController
controller)
{
Console.WriteLine("WillBeginPreview");
}
public override void WillBeginSendingToApplication
(UIDocumentInteractionController controller)
{
// TODO: Implement - see:
http://go-mono.com/docs/index.aspx?link=T%3aMonoTouch.Foundation.ModelAttribute
}
public override void WillPresentOpenInMenu
(UIDocumentInteractionController controller)
{
// TODO: Implement - see:
http://go-mono.com/docs/index.aspx?link=T%3aMonoTouch.Foundation.ModelAttribute
}
public override void WillPresentOptionsMenu
(UIDocumentInteractionController controller)
{
// TODO: Implement - see:
http://go-mono.com/docs/index.aspx?link=T%3aMonoTouch.Foundation.ModelAttribute
}
}
This is the output message
at (wrapper managed-to-native)
MonoTouch.ObjCRuntime.Messaging.void_objc_msgSend (intptr,intptr) <IL
0x00024, 0xffffffff>
at MonoTouch.Foundation.NSObject/MonoTouch_Disposer.Drain
(MonoTouch.Foundation.NSObject) [0x0002a] in
/Developer/MonoTouch/Source/monotouch/monotouch/Foundation/NSObject.cs:305
at (wrapper runtime-invoke) <Module>.runtime_invoke_void__this___object
(object,intptr,intptr,intptr) <IL 0x00052, 0xffffffff>
at (wrapper managed-to-native)
MonoTouch.UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr)
<IL 0x0009f, 0xffffffff>
at MonoTouch.UIKit.UIApplication.Main (string[],string,string) [0x00038]
in /Developer/MonoTouch/Source/monotouch/monotouch/UIKit/UIApplication.cs:26
at MonoTouch.UIKit.UIApplication.Main (string[]) [0x00000] in
/Developer/MonoTouch/Source/monotouch/monotouch/UIKit/UIApplication.cs:31
at MxMobile.iOS.Application.Main (string[]) [0x00000] in
/Users/nexus/Projects/MxMobile.5.0/dev/iPad/Application/Main.cs:16
at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object
(object,intptr,intptr,intptr) <IL 0x00050, 0xffffffff>
Native stacktrace:
0 MyApp 0x000d0de8 mono_handle_native_sigsegv +
343
1 MyApp 0x0000f74c mono_sigsegv_signal_handler
+
322
2 libSystem.B.dylib 0x905e445b _sigtramp + 43
3 ??? 0xffffffff 0x0 + 4294967295
4 ??? 0x0e35247c 0x0 + 238363772
5 ??? 0x07ee8196 0x0 + 133071254
6 MyApp 0x0000f507 mono_jit_runtime_invoke +
1332
7 MyApp 0x001ed259 mono_runtime_invoke + 137
8 MyApp 0x0029d91f monotouch_trampoline + 2527
9 Foundation 0x0137f9a6
__NSThreadPerformPerform
+ 251
10 CoreFoundation 0x00e2301f
__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
11 CoreFoundation 0x00d8128b
__CFRunLoopDoSources0 +
571
12 CoreFoundation 0x00d80786 __CFRunLoopRun + 470
13 CoreFoundation 0x00d80240 CFRunLoopRunSpecific
+
208
14 CoreFoundation 0x00d80161 CFRunLoopRunInMode +
97
15 GraphicsServices 0x03ee0268 GSEventRunModal + 217
16 GraphicsServices 0x03ee032d GSEventRun + 115
17 UIKit 0x01c1a42e UIApplicationMain +
1160
18 ??? 0x07fa9dcb 0x0 + 133864907
19 ??? 0x07fa9b9c 0x0 + 133864348
20 ??? 0x07fa919c 0x0 + 133861788
21 ??? 0x07fa8ff4 0x0 + 133861364
22 ??? 0x07fa9146 0x0 + 133861702
23 MyApp 0x0000f507 mono_jit_runtime_invoke +
1332
24 MyApp 0x001ed259 mono_runtime_invoke + 137
25 MyApp 0x001ef940 mono_runtime_exec_main + 669
26 MyApp 0x001eed2a mono_runtime_run_main + 843
27 MyApp 0x000a3093 mono_jit_exec + 200
28 MyApp 0x002a163d main + 4060
29 MyApp 0x00002819 _start + 208
30 MyApp 0x00002748 start + 40
31 ??? 0x00000002 0x0 + 2
How can I solve this problem? or is there a workaround?
Thanks
Marco
--
View this message in context:
http://monotouch.2284126.n4.nabble.com/UIDocumentInteractionController-CRASH-tp3718260p3718260.html
Sent from the MonoTouch mailing list archive at Nabble.com.
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch