即使设置了正确的隐私密钥,UIImagePickerController也会崩溃

时间:2017-07-11 21:14:00

标签: ios uiimagepickercontroller

我可以暂时从我的应用中的照片库中选择一张图片,但出于某种原因,当用户尝试选择图片时,我现在正在崩溃(EXC_BAD_ACCESS)过去常常。

我尝试将所有隐私条目添加为测试而没有运气。寻找修复,我注意到我有一个类似的日志,没有设置隐私密钥,但我在信息plist中有正确的条目,我有一段时间,我甚至获得了许可警报当试图打开选择器时。这里我的信息plist条目:

enter image description here

我所拥有的筹码如下:

2   CoreFoundation                      0x000000010a43d2b4 +[NSArray arrayWithObjects:count:] + 52,
3   CoreData                            0x00000001184abe90 -[NSSQLEntity _generateInverseRelationshipsAndMore] + 1104,
4   CoreData                            0x00000001185f58dc -[NSSQLModel _generateModel:error:] + 1708,
5   CoreData                            0x00000001184a5dde -[NSSQLModel initWithManagedObjectModel:configurationName:retainHashHack:brokenHashVersion:] + 366,
6   CoreData                            0x00000001184a5142 -[NSSQLCore initWithPersistentStoreCoordinator:configurationName:URL:options:] + 882,
7   CoreData                            0x00000001185a20b9 __91-[NSPersistentStoreCoordinator addPersistentStoreWithType:configuration:URL:options:error:]_block_invoke + 1081,
8   CoreData                            0x00000001185b12f4 gutsOfBlockToNSPersistentStoreCoordinatorPerform + 196,
9   libdispatch.dylib                   0x000000010f78305c _dispatch_client_callout + 8,
10  libdispatch.dylib                   0x000000010f760de6 _dispatch_barrier_sync_f_invoke + 346,
11  CoreData                            0x000000011859e785 _perform + 213,
12  CoreData                            0x00000001184a4b87 -[NSPersistentStoreCoordinator addPersistentStoreWithType:configuration:URL:options:error:] + 567,
13  PhotoLibraryServices                0x000000011c6a4604 +[PLManagedObjectContext _openAndMigrateStoreWithURL:options:coordinator:forceSourceModelVersion:] + 481,
14  PhotoLibraryServices                0x000000011c6a5a3e +[PLManagedObjectContext _configurePersistentStoreCoordinator:] + 312,
15  AssetsLibraryServices               0x000000011cbfb6d9 __pl_dispatch_sync_block_invoke + 25,
16  libdispatch.dylib                   0x000000010f78305c _dispatch_client_callout + 8,
17  libdispatch.dylib                   0x000000010f760de6 _dispatch_barrier_sync_f_invoke + 346,
18  AssetsLibraryServices               0x000000011cbfb6ba pl_dispatch_sync + 70,
19  PhotoLibraryServices                0x000000011c6a661c +[PLManagedObjectContext sharedPersistentStoreCoordinator] + 167,
20  PhotoLibraryServices                0x000000011c6a221f -[PLManagedObjectContext initWithConcurrencyType:useSharedPersistentStoreCoordinator:] + 139,
21  PhotoLibraryServices                0x000000011c6a20a4 +[PLManagedObjectContext contextForPhotoLibrary:name:] + 181,
22  PhotoLibraryServices                0x000000011c60cd88 -[PLPhotoLibrary _loadDatabase:] + 531,
23  PhotoLibraryServices                0x000000011c60295d -[PLPhotoLibrary initWithTransientContext:name:] + 587,
24  Photos                              0x000000010b4468f3 __30-[PHPhotoLibrary photoLibrary]_block_invoke + 59,
25  libdispatch.dylib                   0x000000010f78305c _dispatch_client_callout + 8,
26  libdispatch.dylib                   0x000000010f7689a1 dispatch_once_f + 503,
27  Photos                              0x000000010b4468b2 -[PHPhotoLibrary photoLibrary] + 143,
28  Photos                              0x000000010b44755c -[PHPhotoLibrary registerChangeObserver:] + 189,
29  Photos                              0x000000010b4317f0 -[PHImageManager init] + 419,
30  Photos                              0x000000010b434163 -[PHCachingImageManager init] + 41,
31  PhotosUI                            0x0000000128efa305 -[PUAlbumListViewController initWithSpec:isRootSharedAlbumList:] + 137,
32  PhotosUI                            0x0000000128e91641 -[PUUIAlbumListViewController init] + 66,
33  UIKit                               0x000000010be7166c -[UIImagePickerController _createInitialController] + 712,
34  UIKit                               0x000000010be718ad -[UIImagePickerController _setupControllersForCurrentSourceType] + 45,
35  UIKit                               0x000000010be70ca5 -[UIImagePickerController viewWillAppear:] + 67,
36  UIKit                               0x000000010bc3abad -[UIViewController _setViewAppearState:isAnimating:] + 447,
37  UIKit                               0x000000010bc3b3c3 -[UIViewController __viewWillAppear:] + 147,
38  UIKit                               0x000000010bc10f87 __56-[UIPresentationController runTransitionForCurrentState]_block_invoke + 1041,
39  UIKit                               0x000000010ba9e853 _runAfterCACommitDeferredBlocks + 318,
40  UIKit                               0x000000010ba8b81c _cleanUpAfterCAFlushAndRunDeferredBlocks + 532,
41  UIKit                               0x000000010babd560 _afterCACommitHandler + 137,
42  CoreFoundation                      0x000000010a4c7717 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23,
43  CoreFoundation                      0x000000010a4c7687 __CFRunLoopDoObservers + 391,
44  CoreFoundation                      0x000000010a4ac720 __CFRunLoopRun + 1200,
45  CoreFoundation                      0x000000010a4ac016 CFRunLoopRunSpecific + 406,
46  GraphicsServices                    0x00000001115b2a24 GSEventRunModal + 62,
47  UIKit                               0x000000010ba92134 UIApplicationMain + 159,

在调试期间以及Testflight buids中,模拟器和设备都会发生崩溃,但有趣的是,AppStore上可用的应用程序运行良好。

1 个答案:

答案 0 :(得分:0)

现在正在努力......

我有以下NSObject扩展名,我找到了将类名称作为字符串的地方:

extension NSObject {

    public class var name: String {
        return NSStringFromClass(self).components(separatedBy: ".").last!
    }

    public var name: String {
        return NSStringFromClass(type(of: self)).components(separatedBy: ".").last!
    }
}

更改实例var的名称使照片库再次运行。以防万一我重命名class var,但实例var就是问题。

希望这有助于某人。