0

当我从照片库中选择图片时,应用程序崩溃了。这只发生在 iPhone XS Max 中。

代码:

-(IBAction)choosePhoto:(id)sender {
    AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
    UIViewController *controller = appDelegate.window.rootViewController;
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.modalPresentationStyle = UIModalPresentationCustom;
picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
picker.videoQuality=UIImagePickerControllerQualityTypeHigh;
picker.navigationBar.tintColor = [UIColor whiteColor];
picker.navigationBar.barStyle = UIBarStyleBlackOpaque;
[[NSOperationQueue mainQueue] addOperationWithBlock:^{
    [controller presentViewController:picker animated:YES completion:nil];
}];
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
    NSLog(@"data:%@",info);
    [self dismissViewControllerAnimated:YES completion:NULL];
}

添加隐私 - 照片库使用说明

错误:

    2018-11-01 12:39:05.921918+0530 App[2307:42544] [Common] _BSMachError: port 31f07; (os/kern) invalid capability (0x14) "Unable to insert COPY_SEND"
2018-11-01 12:39:14.451671+0530 App[2307:44980] [error] error: -addPersistentStoreWithType:SQLite configuration:(null) URL:file:///Users/Library/Developer/CoreSimulator/Devices/74B56033-C96A-4EFA-A68F-B4DEAA03E0AA/data/Media/PhotoData/Photos.sqlite options:{
    NSPersistentHistoryTrackingKey =     {
        NSPersistentHistoryTrackingEntitiesToExclude =         (
            AssetAnalysisState,
            MediaAnalysisAssetAttributes,
            ComputedAssetAttributes
        );
        NSPersistentHistoryUseContextObjectsForDeletes = 1;
    };
    NSPersistentStoreFileProtectionKey = NSFileProtectionCompleteUntilFirstUserAuthentication;
    NSSQLitePersistWALOption = 1;
    NSSQLitePragmasOption =     {
        "journal_mode" = WAL;
    };
} ... returned error Error Domain=NSCocoaErrorDomain Code=256 "The file “Photos.sqlite” couldn’t be opened." UserInfo={NSFilePath=/Users/IGDCLT0097/Library/Developer/CoreSimulator/Devices/74B56033-C96A-4EFA-A68F-B4DEAA03E0AA/data/Media/PhotoData/Photos.sqlite, NSSQLiteErrorDomain=7} with userInfo dictionary {
    NSFilePath = "/Users/IGDCLT0097/Library/Developer/CoreSimulator/Devices/74B56033-C96A-4EFA-A68F-B4DEAA03E0AA/data/Media/PhotoData/Photos.sqlite";
    NSSQLiteErrorDomain = 7;
}
CoreData: error: -addPersistentStoreWithType:SQLite configuration:(null) URL:file:///Users/Library/Developer/CoreSimulator/Devices/74B56033-C96A-4EFA-A68F-B4DEAA03E0AA/data/Media/PhotoData/Photos.sqlite options:{
    NSPersistentHistoryTrackingKey =     {
        NSPersistentHistoryTrackingEntitiesToExclude =         (
            AssetAnalysisState,
            MediaAnalysisAssetAttributes,
            ComputedAssetAttributes
        );
        NSPersistentHistoryUseContextObjectsForDeletes = 1;
    };
    NSPersistentStoreFileProtectionKey = NSFileProtectionCompleteUntilFirstUserAuthentication;
    NSSQLitePersistWALOption = 1;
    NSSQLitePragmasOption =     {
        "journal_mode" = WAL;
    };
} ... returned error Error Domain=NSCocoaErrorDomain Code=256 "The file “Photos.sqlite” couldn’t be opened." UserInfo={NSFilePath=/Users/IGDCLT0097/Library/Developer/CoreSimulator/Devices/74B56033-C96A-4EFA-A68F-B4DEAA03E0AA/data/Media/PhotoData/Photos.sqlite, NSSQLiteErrorDomain=7} with userInfo dictionary {
    NSFilePath = "/Users/IGDCLT0097/Library/Developer/CoreSimulator/Devices/74B56033-C96A-4EFA-A68F-B4DEAA03E0AA/data/Media/PhotoData/Photos.sqlite";
    NSSQLiteErrorDomain = 7;
}
2018-11-01 12:39:14.452873+0530 App[2307:44980] [Migration] Unexpected error opening persistent store file:///Users/Library/Developer/CoreSimulator/Devices/74B56033-C96A-4EFA-A68F-B4DEAA03E0AA/data/Media/PhotoData/Photos.sqlite, cannot attempt migration Error Domain=NSCocoaErrorDomain Code=256 "The file “Photos.sqlite” couldn’t be opened." UserInfo={NSFilePath=/Users/IGDCLT0097/Library/Developer/CoreSimulator/Devices/74B56033-C96A-4EFA-A68F-B4DEAA03E0AA/data/Media/PhotoData/Photos.sqlite, NSSQLiteErrorDomain=7})
2018-11-01 12:39:14.453391+0530 App[2307:44980] [Migration] Failed to open store /Users/IGDCLT0097/Library/Developer/CoreSimulator/Devices/74B56033-C96A-4EFA-A68F-B4DEAA03E0AA/data/Media/PhotoData/Photos.sqlite.  Requires update via assetsd (256: The file “Photos.sqlite” couldn’t be opened.)
2018-11-01 12:39:14.479274+0530 App[2307:44980] [error] error: -addPersistentStoreWithType:SQLite configuration:(null) URL:file:///Users/Library/Developer/CoreSimulator/Devices/74B56033-C96A-4EFA-A68F-B4DEAA03E0AA/data/Media/PhotoData/Photos.sqlite options:{
    NSPersistentHistoryTrackingKey =     {
        NSPersistentHistoryTrackingEntitiesToExclude =         (
            AssetAnalysisState,
            MediaAnalysisAssetAttributes,
            ComputedAssetAttributes
        );
        NSPersistentHistoryUseContextObjectsForDeletes = 1;
    };
    NSPersistentStoreFileProtectionKey = NSFileProtectionCompleteUntilFirstUserAuthentication;
    NSSQLitePersistWALOption = 1;
    NSSQLitePragmasOption =     {
        "journal_mode" = WAL;
    };
} ... returned error Error Domain=NSCocoaErrorDomain Code=256 "The file “Photos.sqlite” couldn’t be opened." UserInfo={NSFilePath=/Users/IGDCLT0097/Library/Developer/CoreSimulator/Devices/74B56033-C96A-4EFA-A68F-B4DEAA03E0AA/data/Media/PhotoData/Photos.sqlite, NSSQLiteErrorDomain=7} with userInfo dictionary {
    NSFilePath = "/Users/IGDCLT0097/Library/Developer/CoreSimulator/Devices/74B56033-C96A-4EFA-A68F-B4DEAA03E0AA/data/Media/PhotoData/Photos.sqlite";
    NSSQLiteErrorDomain = 7;
}
CoreData: error: -addPersistentStoreWithType:SQLite configuration:(null) URL:file:///Users/Library/Developer/CoreSimulator/Devices/74B56033-C96A-4EFA-A68F-B4DEAA03E0AA/data/Media/PhotoData/Photos.sqlite options:{
    NSPersistentHistoryTrackingKey =     {
        NSPersistentHistoryTrackingEntitiesToExclude =         (
            AssetAnalysisState,
            MediaAnalysisAssetAttributes,
            ComputedAssetAttributes
        );
        NSPersistentHistoryUseContextObjectsForDeletes = 1;
    };
    NSPersistentStoreFileProtectionKey = NSFileProtectionCompleteUntilFirstUserAuthentication;
    NSSQLitePersistWALOption = 1;
    NSSQLitePragmasOption =     {
        "journal_mode" = WAL;
    };
} ... returned error Error Domain=NSCocoaErrorDomain Code=256 "The file “Photos.sqlite” couldn’t be opened." UserInfo={NSFilePath=/Users/IGDCLT0097/Library/Developer/CoreSimulator/Devices/74B56033-C96A-4EFA-A68F-B4DEAA03E0AA/data/Media/PhotoData/Photos.sqlite, NSSQLiteErrorDomain=7} with userInfo dictionary {
    NSFilePath = "/Users/IGDCLT0097/Library/Developer/CoreSimulator/Devices/74B56033-C96A-4EFA-A68F-B4DEAA03E0AA/data/Media/PhotoData/Photos.sqlite";
    NSSQLiteErrorDomain = 7;
}
2018-11-01 12:39:14.480337+0530 App[2307:44980] [Migration] Store open/configuration failed on 2nd attempt: Error Domain=NSCocoaErrorDomain Code=256 "The file “Photos.sqlite” couldn’t be opened." UserInfo={NSFilePath=/Users/IGDCLT0097/Library/Developer/CoreSimulator/Devices/74B56033-C96A-4EFA-A68F-B4DEAA03E0AA/data/Media/PhotoData/Photos.sqlite, NSSQLiteErrorDomain=7}
2018-11-01 12:39:14.480675+0530 App[2307:44980] [Generic] ABORT: cannot create persistent store
4

0 回答 0