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.
in short i want to know, what should i do to store NSArray into core data.
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
#import <CoreData/CoreData.h>
@class qrandom;
@interface category : NSManagedObject
{
}
@property (nonatomic, retain) NSNumber * cid;
@property (nonatomic, retain) qrandom * randomrelation;
@end
....................................................................................
category.m file
#import "category.h"
#import "qrandom.h"
@implementation category
@dynamic cid;
@dynamic randomrelation;
@end
................................................................................
Answer
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.
See Marcus's answer which suggests just using relationships:
NSMutableArray stored with core data = WORKS, but after changing array DOESN'T WORK
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
Related Questions
- → Web App Image Rotate Issue
- → Website not loading on AT&T LTE; all other carriers and wifi work fine
- → Disable wheel selector on iOS Safari?
- → Opening Image File from JavaScript (doesn't work on mobile phones)
- → React router & Phonegap - First page not found
- → unable to add photo from iphone to canvas
- → What's the best practice for having a Laravel application serve both the browser-based application, and act as an API for the iPhone and Android app?
- → Wordpress mobile nav menu: menu appears on click on iPhone and other mobile devices, but not iPad
- → How to save the response From My server , and How can i access That data
- → Communication between iPhone app and AWS server
- → NSDateFormatterStyle.MediumStyle doesn't show in iPhone
- → Could not find Developer Disk Image - Xcode 7.2 & iOS 9.2
- → String encryption in Objective-C decrypt in C#