3

我正在尝试使用 Core Data 和 CloudKit 构建一个非常基本的应用程序。我在 Mac 上登录了 CloudKit 帐户,并按照说明运行 Apple 在其网站上提供的示例项目。

以示例项目为指导,我尝试使用此处提供的说明构建一个更简单的应用程序。

但是,在构建尝试运行我的示例项目后,我在控制台中收到以下错误堆栈跟踪:

CoreData: debug: CoreData+CloudKit: -[PFCloudKitOptionsValidator validateOptions:andStoreOptions:error:](35): Validating options: <NSCloudKitMirroringDelegateOptions: 0x60000097f960> containerIdentifier:iCloud.com.cybermedia.CloudKitTest1 initializeSchema:YES ckAssetThresholdBytes:<null> operationMemoryThresholdBytes:<null> useEncryptedStorage:NO automaticallyDownloadFileBackedFutures:NO automaticallyScheduleImportAndExportOperations:YES skipCloudKitSetup:NO preserveLegacyRecordMetadataBehavior:NO useDaemon:YES apsConnectionMachServiceName:<null> containerProvider:<PFCloudKitContainerProvider: 0x600002f602e0> scheduler:<null> notificationListener:<null> containerOptions:<null>
storeOptions: {
    NSInferMappingModelAutomaticallyOption = 1;
    NSMigratePersistentStoresAutomaticallyOption = 1;
    NSPersistentCloudKitContainerOptionsKey = "<NSPersistentCloudKitContainerOptions: 0x600002d73960>";
    NSPersistentHistoryTrackingKey = 1;
    NSPersistentStoreMirroringOptionsKey =     {
        NSPersistentStoreMirroringDelegateOptionKey = "<NSCloudKitMirroringDelegate: 0x600001c7dc20>";
    };
}
CoreData: CloudKit: CoreData+CloudKit: -[NSCloudKitMirroringDelegate _setUpCloudKitIntegration](355): <NSCloudKitMirroringDelegate: 0x600001c7dc20>: Successfully enqueued setup request.
CoreData: CloudKit: CoreData+CloudKit: -[NSCloudKitMirroringDelegate checkAndExecuteNextRequest](1854): <NSCloudKitMirroringDelegate: 0x600001c7dc20>: Checking for pending requests.
CoreData: CloudKit: CoreData+CloudKit: -[NSCloudKitMirroringDelegate checkAndExecuteNextRequest]_block_invoke(1866): <NSCloudKitMirroringDelegate: 0x600001c7dc20>: Executing: <NSCloudKitMirroringDelegateSetupRequest: 0x60000232c2a0> 6D32A278-F996-438D-AA8D-950F438F6402
2019-07-06 01:10:45.443340-0400 CloudKitTest1[14002:3818396] [error] error: CoreData+CloudKit: -[NSCloudKitMirroringDelegate _performSetupRequest:]_block_invoke(769): <NSCloudKitMirroringDelegate: 0x600001c7dc20>: Failed to set up CloudKit integration for store: <NSSQLCore: 0x600001274000> (URL: file:///Users/fsyed/Library/Developer/CoreSimulator/Devices/2A838B6E-EF14-4F54-9230-7B747A6DDE9B/data/Containers/Data/Application/249463B2-7348-4DBA-9739-0DDEB0ECBA10/Library/Application%20Support/CloudKitTest1.sqlite)
Error Domain=NSCocoaErrorDomain Code=134400 "Unable to initialize without an iCloud account (CKAccountStatusNoAccount)." UserInfo={NSLocalizedFailureReason=Unable to initialize without an iCloud account (CKAccountStatusNoAccount).}
CoreData: error: CoreData+CloudKit: -[NSCloudKitMirroringDelegate _performSetupRequest:]_block_invoke(769): <NSCloudKitMirroringDelegate: 0x600001c7dc20>: Failed to set up CloudKit integration for store: <NSSQLCore: 0x600001274000> (URL: file:///Users/fsyed/Library/Developer/CoreSimulator/Devices/2A838B6E-EF14-4F54-9230-7B747A6DDE9B/data/Containers/Data/Application/249463B2-7348-4DBA-9739-0DDEB0ECBA10/Library/Application%20Support/CloudKitTest1.sqlite)
Error Domain=NSCocoaErrorDomain Code=134400 "Unable to initialize without an iCloud account (CKAccountStatusNoAccount)." UserInfo={NSLocalizedFailureReason=Unable to initialize without an iCloud account (CKAccountStatusNoAccount).}
2019-07-06 01:10:45.444373-0400 CloudKitTest1[14002:3818396] [error] error: CoreData+CloudKit: -[NSCloudKitMirroringDelegate recoverFromError:](1259): <NSCloudKitMirroringDelegate: 0x600001c7dc20> - Attempting recovery from error: Error Domain=NSCocoaErrorDomain Code=134400 "Unable to initialize without an iCloud account (CKAccountStatusNoAccount)." UserInfo={NSLocalizedFailureReason=Unable to initialize without an iCloud account (CKAccountStatusNoAccount).}
CoreData: error: CoreData+CloudKit: -[NSCloudKitMirroringDelegate recoverFromError:](1259): <NSCloudKitMirroringDelegate: 0x600001c7dc20> - Attempting recovery from error: Error Domain=NSCocoaErrorDomain Code=134400 "Unable to initialize without an iCloud account (CKAccountStatusNoAccount)." UserInfo={NSLocalizedFailureReason=Unable to initialize without an iCloud account (CKAccountStatusNoAccount).}
2019-07-06 01:10:45.445456-0400 CloudKitTest1[14002:3818396] [error] error: CoreData+CloudKit: -[NSCloudKitMirroringDelegate _recoverFromError:withMonitor:](1398): <NSCloudKitMirroringDelegate: 0x600001c7dc20> - Failed to recover from error: Error Domain=NSCocoaErrorDomain Code=134400 "Unable to initialize without an iCloud account (CKAccountStatusNoAccount)." UserInfo={NSLocalizedFailureReason=Unable to initialize without an iCloud account (CKAccountStatusNoAccount).}
Recovery encountered the following error: (null)
CoreData: error: CoreData+CloudKit: -[NSCloudKitMirroringDelegate _recoverFromError:withMonitor:](1398): <NSCloudKitMirroringDelegate: 0x600001c7dc20> - Failed to recover from error: Error Domain=NSCocoaErrorDomain Code=134400 "Unable to initialize without an iCloud account (CKAccountStatusNoAccount)." UserInfo={NSLocalizedFailureReason=Unable to initialize without an iCloud account (CKAccountStatusNoAccount).}
Recovery encountered the following error: (null)
CoreData: CloudKit: CoreData+CloudKit: -[NSCloudKitMirroringDelegate _finishedRequest:withResult:](1883): Finished request: <NSCloudKitMirroringDelegateSetupRequest: 0x60000232c2a0> 6D32A278-F996-438D-AA8D-950F438F6402 with result: <NSCloudKitMirroringResult: 0x600002304ea0>
CoreData: CloudKit: CoreData+CloudKit: -[NSCloudKitMirroringDelegate checkAndExecuteNextRequest](1854): <NSCloudKitMirroringDelegate: 0x600001c7dc20>: Checking for pending requests.
CoreData: CloudKit: CoreData+CloudKit: -[NSCloudKitMirroringDelegate checkAndExecuteNextRequest]_block_invoke(1869): <NSCloudKitMirroringDelegate: 0x600001c7dc20>: No more requests to execute.

我不断收到错误:

NSLocalizedFailureReason=Unable to initialize without an iCloud account 

谁能看到或帮助我确定我做错了什么?

4

1 回答 1

3

您需要在模拟器上登录您的 iCloud 帐户

于 2019-08-06T03:40:56.227 回答