Skip to content

Example App Crash: First time accessing device media library before giving permission. #16

@aerych

Description

@aerych

Expected behavior

To edit a photo in the local device photo library.

Actual behavior

Prompted for permission to access Photos then crashed.

Steps to reproduce the behavior

Settings app > General > Reset > Reset Location & Privacy > Reset Warnings.
Example app > Main screen > Image Editing > Device Library > Edit button.
💥
Works fine on the next launch.

Tested on [device], iOS [version], WPiOS [version]

iPhone X Simulator

Stack Trace

2020-02-10 13:40:58.540740-0600 Example[55893:1421849] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'attempt to scroll to invalid index path: <NSIndexPath: 0x60c000223c40> {length = 2, path = 0 - 0}'
*** First throw call stack:
(
0 CoreFoundation 0x000000010b95b1e6 __exceptionPreprocess + 294
1 libobjc.A.dylib 0x0000000107687031 objc_exception_throw + 48
2 CoreFoundation 0x000000010b9d0975 +[NSException raise:format:] + 197
3 UIKit 0x00000001097c73ef -[UICollectionView _contentOffsetForScrollingToItemAtIndexPath:atScrollPosition:] + 212
4 UIKit 0x00000001097c7e5b -[UICollectionView _scrollToItemAtIndexPath:atScrollPosition:animated:] + 70
5 UIKit 0x00000001097af155 -[UICollectionView _selectItemAtIndexPath:animated:scrollPosition:notifyDelegate:] + 537
6 UIKit 0x00000001097af29b -[UICollectionView selectItemAtIndexPath:animated:scrollPosition:] + 129
7 MediaEditor 0x0000000106feee4b $s11MediaEditor0aB3HubC25reloadImagesAndReposition33_9A39579BAD8EDF62FEB03FFB3FF99D41LLyyF + 1595
8 MediaEditor 0x0000000106feb110 $s11MediaEditor0aB3HubC24traitCollectionDidChangeyySo07UITraitE0CSgF + 128
9 MediaEditor 0x0000000106feb164 $s11MediaEditor0aB3HubC24traitCollectionDidChangeyySo07UITraitE0CSgFTo + 68
10 UIKit 0x0000000108e93288 -[UIViewController _traitCollectionDidChange:] + 108
11 UIKit 0x0000000108e933ab -[UIViewController _updateTraitsIfNecessary] + 269
12 UIKit 0x0000000108dc05f3 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1078
13 QuartzCore 0x000000010beb2456 -[CALayer layoutSublayers] + 177
14 QuartzCore 0x000000010beb6667 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 395
15 UIKit 0x0000000108daa62d -[UIView(Hierarchy) layoutBelowIfNeeded] + 662
16 MediaEditor 0x0000000106fee949 $s11MediaEditor0aB3HubC25reloadImagesAndReposition33_9A39579BAD8EDF62FEB03FFB3FF99D41LLyyF + 313
17 MediaEditor 0x0000000106feb110 $s11MediaEditor0aB3HubC24traitCollectionDidChangeyySo07UITraitE0CSgF + 128
18 MediaEditor 0x0000000106feb164 $s11MediaEditor0aB3HubC24traitCollectionDidChangeyySo07UITraitE0CSgFTo + 68
19 UIKit 0x0000000108e93288 -[UIViewController _traitCollectionDidChange:] + 108
20 UIKit 0x0000000108e933ab -[UIViewController _updateTraitsIfNecessary] + 269
21 UIKit 0x0000000108dc05f3 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1078
22 QuartzCore 0x000000010beb2456 -[CALayer layoutSublayers] + 177
23 QuartzCore 0x000000010beb6667 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 395
24 QuartzCore 0x000000010be3d0fb _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 343
25 QuartzCore 0x000000010be6a79c _ZN2CA11Transaction6commitEv + 568
26 UIKit 0x0000000108d19f2c _afterCACommitHandler + 272
27 CoreFoundation 0x000000010b8fd607 CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION + 23
28 CoreFoundation 0x000000010b8fd55e __CFRunLoopDoObservers + 430
29 CoreFoundation 0x000000010b8e1b81 __CFRunLoopRun + 1537
30 CoreFoundation 0x000000010b8e130b CFRunLoopRunSpecific + 635
31 GraphicsServices 0x000000010fa36a73 GSEventRunModal + 62
32 UIKit 0x0000000108cf1057 UIApplicationMain + 159
33 Example 0x0000000106c6418b main + 75
34 libdyld.dylib 0x000000010d493955 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

Screen shot of the moment of the crash

Screen Shot 2020-02-10 at 1 33 22 PM

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions