iOS核心数据+ iCloud的addPersistentStoreWithType错误:您无权将文件“存储”保存在文件夹中 [英] iOS Core Data + iCloud error for addPersistentStoreWithType: You don’t have permission to save the file “store” in the folder

查看:180
本文介绍了iOS核心数据+ iCloud的addPersistentStoreWithType错误:您无权将文件“存储”保存在文件夹中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从头开始创建了一个核心数据项目,我所做的唯一更改是持久性协调器正在添加商店的地方,我提供了NSPersistentStoreUbiquitousContentNameKey选项:

I've created a Core Data project from scratch, the only change I made is that where the persistent coordinator is adding a store, I'm providing a NSPersistentStoreUbiquitousContentNameKey option:

coordinator.addPersistentStoreWithType(NSSQLiteStoreType, configuration: nil, URL: url, options: [NSPersistentStoreUbiquitousContentNameKey : "coreDataiCloudTestStore"])

,然后在启动时插入并保存新的托管对象。

and I'm inserting and saving a new managed object at launch.

启动时没有iCloud帐户已登录,没有问题。应用运行时,我正在登录iCloud并返回到该应用。我收到此错误消息:您无权将文件存储保存在文件夹中,不允许进行以下操作:

When at launch there is no iCloud account logged in, no problems. While the app is running, I'm logging into iCloud and going back to the app. I'm getting this error: You don’t have permission to save the file "store" in the folder, operation not permitted:


CoreData:错误:-addPersistentStoreWithType:SQLite
配置:PF_DEFAULT_CONFIGURATION_NAME
URL:file:/// var / mobile / Containers / Data / Application / 9032B2BC-BE8B-42C9-A9CC-EF3E01AA6F2B / Documents / SingleViewCoreData。 sqlite
选项:{
NSPersistentStoreUbiquitousContentNameKey = coreDataiCloudTestStore;
PFUbiquitySetupSynchronousSideLoadKey = 1; }

CoreData: error: -addPersistentStoreWithType:SQLite configuration:PF_DEFAULT_CONFIGURATION_NAME URL:file:///var/mobile/Containers/Data/Application/9032B2BC-BE8B-42C9-A9CC-EF3E01AA6F2B/Documents/SingleViewCoreData.sqlite options:{ NSPersistentStoreUbiquitousContentNameKey = coreDataiCloudTestStore; PFUbiquitySetupSynchronousSideLoadKey = 1; }

...返回错误错误Domain = NSCocoaErrorDomain Code = 513您无权将文件存储保存在文件夹中
380E290C-97F9-4DC3-9B3C-43322FCA455D。
UserInfo = {NSFilePath = / var / mobile / Containers / Data / Application / 9032B2BC-BE8B-42C9-A9CC-EF3E01AA6F2B / Documents / CoreDataUbiquitySupport / mobile〜C5A2ECE3-1AB9-45FA-9C15-037DCCA054DE / coreDataiCloudTestStore / 380E 97F9-4DC3-9B3C-43322FCA455D / store,
NSUnderlyingError = 0x1453f430 {Error Domain = NSPOSIXErrorDomain代码= 1
不允许操作}},带有userInfo字典{
NSFilePath = / var / mobile /容器/数据/应用程序/ 9032B2BC-BE8B-42C9-A9CC-EF3E01AA6F2B / Documents / CoreDataUbiquitySupport / mobile〜C5A2ECE3-1AB9-45FA-9C15-037DCCA054DE / coreDataiCloudTestStore / 380E290C-97F9-4DC3-9B3C-C;
NSUnderlyingError =错误域= NSPOSIXErrorDomain代码= 1 \不允许操作\; }

... returned error Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file "store" in the folder "380E290C-97F9-4DC3-9B3C-43322FCA455D"." UserInfo={NSFilePath=/var/mobile/Containers/Data/Application/9032B2BC-BE8B-42C9-A9CC-EF3E01AA6F2B/Documents/CoreDataUbiquitySupport/mobile~C5A2ECE3-1AB9-45FA-9C15-037DCCA054DE/coreDataiCloudTestStore/380E290C-97F9-4DC3-9B3C-43322FCA455D/store, NSUnderlyingError=0x1453f430 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}} with userInfo dictionary { NSFilePath = "/var/mobile/Containers/Data/Application/9032B2BC-BE8B-42C9-A9CC-EF3E01AA6F2B/Documents/CoreDataUbiquitySupport/mobile~C5A2ECE3-1AB9-45FA-9C15-037DCCA054DE/coreDataiCloudTestStore/380E290C-97F9-4DC3-9B3C-43322FCA455D/store"; NSUnderlyingError = "Error Domain=NSPOSIXErrorDomain Code=1 \"Operation not permitted\""; }

PFUbiquitySwitchboardEntry containerIdentifierChanged ::
CoreData:Ubiquity:在更改了
帐户并添加选项后,加载新的临时协调器时出错
{ {
NSPersistentStoreUbiquitousContentNameKey = coreDataiCloudTestStore; }}和URL
file:///var/mobile/Containers/Data/Application/9032B2BC-BE8B-42C9-A9CC-EF3E01AA6F2B/Documents/SingleViewCoreData.sqlite
和错误=错误域= NSCocoaErrorDomain代码= 513 您没有
权限将文件存储保存在文件夹中

380E290C-97F9-4DC3-9B3C-43322FCA455D。
UserInfo = {NSFilePath = / var / mobile / Containers / Data / Application / 9032B2BC-BE8B-42C9-A9CC-EF3E01AA6F2B / Documents / CoreDataUbiquitySupport / mobile〜C5A2ECE3-1AB9-45FA-9C15-037DCCA054DE / coreDataiCloudTestStore / 380E 97F9-4DC3-9B3C-43322FCA455D / store,
NSUnderlyingError = 0x1453f430 {Error Domain = NSPOSIXErrorDomain代码= 1
不允许操作}}

PFUbiquitySwitchboardEntry containerIdentifierChanged:: CoreData: Ubiquity: Error loading new temporary coordinator after account change with options { { NSPersistentStoreUbiquitousContentNameKey = coreDataiCloudTestStore; } } and URL file:///var/mobile/Containers/Data/Application/9032B2BC-BE8B-42C9-A9CC-EF3E01AA6F2B/Documents/SingleViewCoreData.sqlite and error = Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file "store" in the folder "380E290C-97F9-4DC3-9B3C-43322FCA455D"." UserInfo={NSFilePath=/var/mobile/Containers/Data/Application/9032B2BC-BE8B-42C9-A9CC-EF3E01AA6F2B/Documents/CoreDataUbiquitySupport/mobile~C5A2ECE3-1AB9-45FA-9C15-037DCCA054DE/coreDataiCloudTestStore/380E290C-97F9-4DC3-9B3C-43322FCA455D/store, NSUnderlyingError=0x1453f430 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}

为什么会这样?

推荐答案


  • 可能是由于

  • 在不让核心数据处理重建支持icloud的持久性存储重建时发生

  • 必须在选项中启用NSPersistentStoreRebuildFromUbiquitousContentOption标志

    • Probably this is due to the options that you pass in when adding persistent store,
    • It happens when you don't let the core data handles the rebuilding icloud-enabled persistent store,
    • You must enable the NSPersistentStoreRebuildFromUbiquitousContentOption flag in the options

      查看苹果文档
      https://developer.apple.com/library/ios/documentation/DataManagement/Conceptual/UsingCoreDataWithiCloudPG/UsingSQLiteStoragewithiCloud/UsingSQLiteStoragewithiCloud.html

      从iCloud重建


      要删除本地数据并从iCloud中的现有记录重新开始,请在将启用iCloud的持久性存储添加到持久性存储协调器时,将NSPersistentStoreRebuildFromUbiquitousContentOption选项传递给值@YES。包括通常包含的所有iCloud选项。

      To remove local data and start fresh with the existing records in iCloud, pass the NSPersistentStoreRebuildFromUbiquitousContentOption option with a value of @YES when you add your iCloud-enabled persistent store to the persistent store coordinator. Include any iCloud options you usually include.

      这篇关于iOS核心数据+ iCloud的addPersistentStoreWithType错误:您无权将文件“存储”保存在文件夹中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆