Hi!
Recently our app had a strange crash. It's about PHPhotoLibrary. We can't reproduce it. And we can sure the user has authorized the album. It has been troubling us for a month.
Has anyone encountered similar problems?
Exception: Access to the photo library is not allowed until the photo library is obtainable.
Here is the crash stack.
Stack trace:
Fatal Exception: NSInternalInconsistencyException
0 CoreFoundation 0xecb28 __exceptionPreprocess
1 libobjc.A.dylib 0x2af78 objc_exception_throw
2 PhotoLibraryServices 0x60d6c -[PLPhotoLibrary loadDatabaseWithOptions:error:]
3 PhotoLibraryServices 0x64dec +[PLPhotoLibrary newPhotoLibraryWithName:loadedFromBundle:options:error:]
4 Photos 0xf2810 newPhotoLibrary
5 Photos 0xf2328 __50-[PHPhotoLibrary initWithPhotoLibraryBundle:type:]_block_invoke_4
6 PhotoLibraryServicesCore 0x446c __27-[PLLazyObject objectValue]block_invoke
7 PhotoLibraryServicesCore 0x43e0 PLResultWithUnfairLock
8 PhotoLibraryServicesCore 0x4388 -[PLLazyObject objectValue]
9 Photos 0xf092c -[PHPhotoLibrary backgroundQueuePhotoLibrary]
10 Photos 0xf0830 -[PHPhotoLibrary photoLibraryForCurrentQueueQoS]
11 Photos 0xf72bc -[PHPhotoLibrary(PXCPLStatus) managedObjectContextForCurrentQueueQoS]
12 Photos 0x17d800 -[PHQuery createFetchRequestIncludingBasePredicate:]
13 Photos 0x17d37c -[PHQuery fetchRequest]
14 Photos 0x1fb2fc -[PHFetchResult initWithQuery:oids:registerIfNeeded:usingManagedObjectContext:]
15 Photos 0x1fb16c -[PHFetchResult initWithQuery:]
16 Photos 0x17bc8c __23-[PHQuery executeQuery]block_invoke
17 Photos 0x17ee74 PHQueryForAssetCollectionType_Album_block_invoke_97
18 Photos 0x17bb98 -[PHQuery executeQuery]
19 Photos 0x3a744 __67+[PHAssetCollection fetchAssetCollectionsWithType:subtype:options:]block_invoke
20 Photos 0x1704e4 +[PHObject authorizationAwareFetchResultWithOptions:fetchBlock:]
21 Photos 0x3a69c +[PHAssetCollection fetchAssetCollectionsWithType:subtype:options:]
22 INSBusinessServices 0x46b994 PHPhotoLibrary.fetchAlbums(withName:) + 391 (PHPhotoLibrary+Custom.swift:391)
23 Insta360 ONE R 0x5008ac closure #1 in Album.loadMediasAtSystemAlbum(notNeedTypeIsVideo:) + 122 (Album+Assets.swift:122)
24 ReactiveSwift 0x19b70 closure #1 in SignalProducer.init(:) + 112 (SignalProducer.swift:112)
25 ReactiveSwift 0x2da50 partial apply for closure #1 in GeneratorCore.makeInstance() + 433 (SignalProducer.swift:433)
26 ReactiveSwift 0x192d8 SignalProducer.startWithSignal(:) + 227 (SignalProducer.swift:227)
27 ReactiveSwift 0x2eb14 partial apply for closure #1 in closure #1 in SignalProducer.start(on:) + 2045 (SignalProducer.swift:2045)
28 INSFoundationKit 0xe5010 partial apply for closure #1 in GCDGloabalScheduler.schedule(:) + 19 (GCDAide.swift:19)
29 INSFoundationKit 0xe50c4 partial apply for closure #1 in static GCDAide.asyncOnGlobal(after::)
30 INSFoundationKit 0x25338 thunk for @escaping @callee_guaranteed () -> ()
31 libdispatch.dylib 0x213c _dispatch_call_block_and_release
32 libdispatch.dylib 0x3dd4 _dispatch_client_callout
33 libdispatch.dylib 0x72d8 _dispatch_continuation_pop
34 libdispatch.dylib 0x68f4 _dispatch_async_redirect_invoke
35 libdispatch.dylib 0x15894 _dispatch_root_queue_drain
36 libdispatch.dylib 0x1609c _dispatch_worker_thread2
37 libsystem_pthread.dylib 0x1ee4 _pthread_wqthread
38 libsystem_pthread.dylib 0x1fc0 start_wqthread