alexhillc / AXPhotoViewer

An iOS/tvOS photo gallery viewer, useful for viewing a large (or small!) number of photos.
https://www.cocoacontrols.com/controls/axphotoviewer
MIT License
647 stars 119 forks source link

Crash - AXPhotoViewController.applyPhoto(_:) (AXPhotoViewController.swift:105) #59

Open abdullahumer opened 5 years ago

abdullahumer commented 5 years ago

I am seeing the following crash in Crashlytics.

I am using the latest v1.7.1

Crashed: com.apple.main-thread
0  libswiftFoundation.dylib       0x1050aa5bc protocol witness for Error._domain.getter in conformance CFErrorRef + 6672
1  libswiftCore.dylib             0x104b501c4 _getErrorDomainNSString<A>(_:) + 43576
2  libswiftCore.dylib             0x104d87f3c _swift_stdlib_bridgeErrorToNSError + 220
3  AXPhotoViewer                  0x10391329c AXPhotoViewController.applyPhoto(_:) (AXPhotoViewController.swift:105)
4  AXPhotoViewer                  0x1039075f8 AXPhotosViewController.makePhotoViewController(for:) (<compiler-generated>)
5  AXPhotoViewer                  0x1039104bc specialized AXPhotosViewController.pageViewController(_:viewControllerBefore:) (AXPhotosViewController.swift:931)
6  AXPhotoViewer                  0x103909464 @objc AXPhotosViewController.pageViewController(_:viewControllerBefore:) + 60
7  UIKitCore                      0x1bbdc7ef4 -[UIPageViewController _viewControllerBefore:viewController:] + 108
8  UIKitCore                      0x1bbdcd904 -[UIPageViewController _queuingScrollView:viewBefore:view:] + 268
9  UIKitCore                      0x1bbdcd9e8 -[UIPageViewController queuingScrollView:viewBeforeView:] + 64
10 UIKitCore                      0x1bbdd5230 -[_UIQueuingScrollView _viewBefore:view:] + 108
11 UIKitCore                      0x1bbdd58d8 -[_UIQueuingScrollView _requestViewForIndex:] + 128
12 UIKitCore                      0x1bbdd5c64 -[_UIQueuingScrollView _viewAtIndex:loadingIfNecessary:updatingContents:animated:] + 196
13 UIKitCore                      0x1bbdd80c4 -[_UIQueuingScrollView _adjustContentInsets] + 168
14 UIKitCore                      0x1bbdd5768 -[_UIQueuingScrollView _replaceViews:updatingContents:adjustContentInsets:animated:] + 640
15 UIKitCore                      0x1bbdd8d04 -[_UIQueuingScrollView _didScrollWithAnimation:force:] + 1040
16 UIKitCore                      0x1bbdd4898 -[_UIQueuingScrollView layoutSubviews] + 200
17 UIKitCore                      0x1bc8ad77c -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1380
18 QuartzCore                     0x193715b7c -[CALayer layoutSublayers] + 184
19 QuartzCore                     0x19371ab34 CA::Layer::layout_if_needed(CA::Transaction*) + 324
20 QuartzCore                     0x193679598 CA::Context::commit_transaction(CA::Transaction*) + 340
21 QuartzCore                     0x1936a7ec8 CA::Transaction::commit() + 608
22 QuartzCore                     0x1935e62a4 CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 324
23 IOKit                          0x18f379b24 IODispatchCalloutFromCFMessage + 488
24 CoreFoundation                 0x18f082f0c __CFMachPortPerform + 188
25 CoreFoundation                 0x18f0aa758 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 56
26 CoreFoundation                 0x18f0a9ea4 __CFRunLoopDoSource1 + 440
27 CoreFoundation                 0x18f0a4c5c __CFRunLoopRun + 2140
28 CoreFoundation                 0x18f0a40e0 CFRunLoopRunSpecific + 436
29 GraphicsServices               0x19131d584 GSEventRunModal + 100
30 UIKitCore                      0x1bc404c00 UIApplicationMain + 212
31 Haraj                          0x102a1e428 main (main.m:16)
32 libdyld.dylib                  0x18eb62bb4 start + 4
alexhillc commented 5 years ago

Hey @abdullahumer - any idea which iOS version this was on?

nemissm commented 4 years ago

Maybe it's because of wrong NSError() initialization in case .loadingFailed. To fix this you should initialize NSError with domain and code.