简体   繁体   English

该操作无法完成。 (可可错误1560.)

[英]The operation couldn’t be completed. (Cocoa error 1560.)

i am using core data in my application. 我在我的应用程序中使用核心数据。

i am getting this error when using transformable attribute to store NSArray. 我使用transformable属性存储NSArray时收到此错误。

in short i want to know, what should i do to store NSArray into core data. 总之,我想知道,我该怎么做才能将NSArray存储到核心数据中。

and how to retrive it. 以及如何回顾它。

this is my code. 这是我的代码。

#import <CoreData/CoreData.h>

@class category;

@interface qrandom :  NSManagedObject  
{
}

@property (nonatomic, retain) NSArray* arr;
@property (nonatomic, retain) category * cid;

@end

........................................................................................... .................................................. .........................................

#import "qrandom.h"

#import "category.h"

@implementation qrandom 

@dynamic arr;
@dynamic cid;

@end

................................................................... .................................................. .................

category.h file category.h文件

#import <CoreData/CoreData.h>

@class qrandom;

@interface category :  NSManagedObject  
{
}
@property (nonatomic, retain) NSNumber * cid;
@property (nonatomic, retain) qrandom * randomrelation;

@end

.................................................................................... .................................................. ..................................

category.m file category.m文件

#import "category.h"
#import "qrandom.h"

@implementation category

@dynamic cid;
@dynamic randomrelation;

@end

................................................................................ .................................................. ..............................

在此输入图像描述

Basically directly storing an NSArray or an NSDictionary as a transformable attribute won't work in CoreData because it will be unable to retrieve the array's values. 基本上直接存储NSArrayNSDictionary作为可转换属性在CoreData中不起作用,因为它将无法检索数组的值。

See Marcus's answer which suggests just using relationships: 请参阅Marcus的回答,其中建议仅使用关系:

NSMutableArray stored with core data = WORKS, but after changing array DOESN'T WORK NSMutableArray与核心数据= WORKS一起存储,但在更改数组后不能正常工作

BUT! 但!

You can archive your array so that it CAN be used in your managed object. 您可以归档阵列,以便可以在托管对象中使用它。 See jbrennan's response here: Saving an NSMutableArray to Core Data 请参阅jbrennan的回复: 将NSMutableArray保存到Core Data

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 “这项行动无法完成。 (可可错误512.)“ - “The operation couldn’t be completed. (Cocoa error 512.)” 该操作无法完成。 (MKErrorDomain错误4) - The operation couldn’t be completed. (MKErrorDomain error 4) 无法保存到数据存储:无法完成操作。 (可可错误133020.) - Failed to save to data store: The operation couldn’t be completed. (Cocoa error 133020.) 该操作无法完成。 不允许操作 - The operation couldn’t be completed. Operation not permitted DBRequest#connectionDidFinishLoading:将临时文件移动到所需位置时出错:无法完成操作。 (可可错误4.) - DBRequest#connectionDidFinishLoading: error moving temp file to desired location: The operation couldn’t be completed. (Cocoa error 4.) 该操作无法完成。 (可可错误512.)Coredata Iphone。 没有文件可以复制到文档文件夹中 - The operation couldn’t be completed. (Cocoa error 512.) Coredata Iphone. No files can be copied in documents folder 位置管理器错误:操作无法完成。 (kCLErrorDomain错误0。) - Location Manger Error: The operation couldn’t be completed. (kCLErrorDomain error 0.) iOS 5.0 AVAudioPlayer加载音频片段时出错:无法完成该操作。 (OSStatus错误-50。) - iOS 5.0 AVAudioPlayer Error loading audio clip: The operation couldn’t be completed. (OSStatus error -50.) ionic无法加载网页,并显示以下错误:操作无法完成。 (NSURLErrorDomain错误-999。) - ionic failed to load webpage with error: The operation couldn’t be completed. (NSURLErrorDomain error -999.) Facebook对话框失败并显示错误:无法完成操作。 (NSURLErrorDomain错误-999。) - Facebook dialog failed with error: The operation couldn’t be completed. (NSURLErrorDomain error -999.)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM