We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

PdfViewer crash in iOS

I have a modal PdfViewer page that works fine in Android, but crashes when opened in iOS. This started happening when I updated the SyncFusion package to 16.4.0.42 and I also updated Xamarin.Forms to 3.4.0.1008975. Before that, the modal page opened and displayed my PDF, but it was really zoomed in to one corner, and the bound page number was incorrect (the PDF opened on the first page, but was showing page 5). In addition, highlighting, adding free text, and other controls were not working in iOS, but worked fine in Android. 

Here is the stack trace:

Foundation.MonoTouchException: Objective-C exception thrown.  Name: CALayerInvalidGeometry Reason: CALayer bounds contains NaN: [-207 nan; 414 718]

Native stack trace:

0   CoreFoundation                      0x00000001103a71bb __exceptionPreprocess + 331

1   libobjc.A.dylib                     0x000000011ccf1735 objc_exception_throw + 48

2   CoreFoundation                      0x00000001103a7015 +[NSException raise:format:] + 197

3   QuartzCore                          0x0000000120a7a3c7 _ZN2CA5Layer10set_boundsERKNS_4RectEb + 201

4   QuartzCore                          0x0000000120a69203 -[CALayer setBounds:] + 254

5   UIKitCore                           0x00000001266c841e -[UIView(Geometry) setBounds:] + 454

6   UIKitCore                           0x0000000126659c7b -[UIScrollView setBounds:] + 1072

7   UIKitCore                           0x000000012665aefd -[UIScrollView setContentOffset:] + 509

8   ManualViewer.iOS                    0x000000010fc2ad0c xamarin_dyn_objc_msgSendSuper + 220

9   ???                                 0x0000000145751d74 0x0 + 5460270452

10  ???                                 0x0000000144d04de6 0x0 + 5449469414

11  ManualViewer.iOS                    0x000000010fa1e7a1 mono_jit_runtime_invoke + 1441

12  ManualViewer.iOS                    0x000000010fb0dd0f mono_runtime_invoke_checked + 127

13  ManualViewer.iOS                    0x000000010fb11683 mono_runtime_invoke + 83

14  ManualViewer.iOS                    0x000000010fc2118d xamarin_invoke_trampoline + 6109

15  ManualViewer.iOS                    0x000000010fc2962d xamarin_arch_trampoline + 189

16  ManualViewer.iOS                    0x000000010fc2aa61 xamarin_x86_64_common_trampoline + 110

17  UIKitCore                           0x00000001266e4795 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1441

18  QuartzCore                          0x0000000120a6fb19 -[CALayer layoutSublayers] + 175

19  QuartzCore                          0x0000000120a749d3 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 395

20  QuartzCore                          0x00000001209ed7ca _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 342

21  QuartzCore                          0x0000000120a2497e _ZN2CA11Transaction6commitEv + 576

22  UIKitCore                           0x0000000126223f81 _afterCACommitHandler + 268

23  CoreFoundation                      0x000000011030bc27 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23

24  CoreFoundation                      0x00000001103060be __CFRunLoopDoObservers + 430

25  CoreFoundation                      0x0000000110306751 __CFRunLoopRun + 1537

26  CoreFoundation                      0x0000000110305e11 CFRunLoopRunSpecific + 625

27  GraphicsServices                    0x0000000120cdd1dd GSEventRunModal + 62

28  UIKitCore                           0x00000001261fa81d UIApplicationMain + 140

29  ???                                 0x00000001431cdb1e 0x0 + 5420931870

30  ???                                 0x00000001431cd8b3 0x0 + 5420931251


  at ObjCRuntime.Runtime.ThrowNSException (System.IntPtr ns_exception) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.2.1.12/src/Xamarin.iOS/ObjCRuntime/Runtime.cs:398

  at ObjCRuntime.Runtime.throw_ns_exception (System.IntPtr exc) [0x00000] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/runtime/Delegates.generated.cs:128

  at at (wrapper native-to-managed) ObjCRuntime.Runtime.throw_ns_exception(intptr)

  at at (wrapper managed-to-native) ObjCRuntime.Messaging.void_objc_msgSendSuper_CGPoint(intptr,intptr,CoreGraphics.CGPoint)

  at UIKit.UIScrollView.set_ContentOffset (CoreGraphics.CGPoint value) [0x00024] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.2.1.12/src/Xamarin.iOS/UIKit/UIScrollView.g.cs:535

  at Syncfusion.SfPdfViewer.XForms.iOS.ScrollViewEx.set_ContentOffset (CoreGraphics.CGPoint value) [0x00000] in <d88aab3a8fcd48c3b429c49aa62e02d5>:0

  at Syncfusion.SfPdfViewer.XForms.iOS.ScrollViewEx.LayoutSubviews () [0x0056d] in <d88aab3a8fcd48c3b429c49aa62e02d5>:0

  at at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)

  at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.2.1.12/src/Xamarin.iOS/UIKit/UIApplication.cs:79

  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0002c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.2.1.12/src/Xamarin.iOS/UIKit/UIApplication.cs:63

  at ManualViewer.iOS.Application.Main (System.String[] args) [0x00001] in /Users/krikoz/Developer/ManualViewer/ManualViewer.iOS/Main.cs:17

  at at (wrapper managed-to-native) ObjCRuntime.Messaging.void_objc_msgSendSuper_CGPoint(intptr,intptr,CoreGraphics.CGPoint)

  at UIKit.UIScrollView.set_ContentOffset (CoreGraphics.CGPoint value) [0x00024] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.2.1.12/src/Xamarin.iOS/UIKit/UIScrollView.g.cs:535

  at Syncfusion.SfPdfViewer.XForms.iOS.ScrollViewEx.set_ContentOffset (CoreGraphics.CGPoint value) [0x00000] in <d88aab3a8fcd48c3b429c49aa62e02d5>:0

  at Syncfusion.SfPdfViewer.XForms.iOS.ScrollViewEx.LayoutSubviews () [0x0056d] in <d88aab3a8fcd48c3b429c49aa62e02d5>:0

  at at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)

  at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.2.1.12/src/Xamarin.iOS/UIKit/UIApplication.cs:79

  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0002c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.2.1.12/src/Xamarin.iOS/UIKit/UIApplication.cs:63

  at ManualViewer.iOS.Application.Main (System.String[] args) [0x00001] in /Users/krikoz/Developer/ManualViewer/ManualViewer.iOS/Main.cs:17



2 Replies

ZC Zach Carls December 17, 2018 07:13 PM UTC

After further digging, the error only occurs when I disable the built-in toolbar. When setting the pdfViewerControl.Toolbar.Enabled equal to False in either the code behind or XAML, the above error occurs.



KK Karthik Krishnaraj Syncfusion Team December 24, 2018 09:08 AM UTC

Hi Kristen, 
 
Greetings from Syncfusion, 
 
We are able to reproduce the issue “MonoTouchException occurs when loading PDF document without toolbar in Xamarin.Forms.iOS” using PDF Viewer control and confirmed this is to be a defect. We will resolve this issue and the fix will be included in our Volume 4 SP1 release which will be rolled out in the end of January 2019. 
 
Regards, 
Karthik 


Loader.
Up arrow icon