core-data

Error : CoreData: error: Failed to call designated initializer on NSManagedObject class 'Product'

白昼怎懂夜的黑 提交于 2020-01-21 07:15:26
问题 I start to use core data with ios 5. I have my product model : Product.m : #import "Product.h" @implementation Product @dynamic category_id; @dynamic label; @dynamic price; @end Product.h : #import <Foundation/Foundation.h> #import <CoreData/CoreData.h> @interface Product : NSManagedObject @property (nonatomic, retain) NSString *category_id; @property (nonatomic, retain) NSString *label; @property (nonatomic, retain) NSString *price; @end I try to parse an xml with a custom class using

CoreData Swift: How to save and load data?

你离开我真会死。 提交于 2020-01-20 22:06:12
问题 I'm writing an iOS game in Swift, and I wanted to include a highscore label at the end. I think that the saving function is correct, but the load one is the one which is giving me problems. I already created an entity ("BestScores") and the attributes ("classicBestScoreTF"): To save the highscore: var bestscore25 = 1000 var score: int func savescore() { var appDel: AppDelegate = (UIApplication.sharedApplication().delegate as AppDelegate) var context:NSManagedObjectContext = appDel

CoreData 'This NSPersistentStoreCoordinator has no persistent stores. It cannot perform a save operation.'

十年热恋 提交于 2020-01-20 14:21:31
问题 I have been following these instructions to help integrate iCloud support with CoreData and I am getting some errors. I have this in my AppDelegate: - (NSPersistentStoreCoordinator *)persistentStoreCoordinator { if (persistentStoreCoordinator != nil) { return persistentStoreCoordinator; } //NSURL *storeURL = [[self applicationDocumentsDirectory] URLByAppendingPathComponent:@"Little_Wedding_Book_Universal.sqlite"]; NSString *storePath = [[NSString stringWithFormat:@"%@", [self

App “failed to resume in time” and hangs

被刻印的时光 ゝ 提交于 2020-01-20 02:26:07
问题 My app runs fine on my ipad but when I run it on my bosses ipad it hangs and stores the following device log, any ideas? Incident Identifier: 6C33511B-7C9A-474C-B888-84A4FAFF6F91 CrashReporter Key: 93bbba4f690eb1b7638fa7a09a3ff3aa4e6872f4 Hardware Model: iPad2,1 Process: Designer [5279] Path: /var/mobile/Applications/7AA5BF4A-007D-47F8-B1C5-30667477AA12/Designer.app/Designer Identifier: Designer Version: ??? (???) Code Type: ARM (Native) Parent Process: launchd [1] Date/Time: 2011-10-19 13:29

App “failed to resume in time” and hangs

前提是你 提交于 2020-01-20 02:26:06
问题 My app runs fine on my ipad but when I run it on my bosses ipad it hangs and stores the following device log, any ideas? Incident Identifier: 6C33511B-7C9A-474C-B888-84A4FAFF6F91 CrashReporter Key: 93bbba4f690eb1b7638fa7a09a3ff3aa4e6872f4 Hardware Model: iPad2,1 Process: Designer [5279] Path: /var/mobile/Applications/7AA5BF4A-007D-47F8-B1C5-30667477AA12/Designer.app/Designer Identifier: Designer Version: ??? (???) Code Type: ARM (Native) Parent Process: launchd [1] Date/Time: 2011-10-19 13:29

numberOfRowsInSection: method for core data and multiple sections

假如想象 提交于 2020-01-19 13:09:10
问题 I am trying to show a table view with 2 sections. The first section will always have 1 row and the second section will have as many rows as data points. I am using Core Data and the following tableView:numberOfRowsInSection: method... - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { if (section == 0) { return 1; } else { id <NSFetchedResultsSectionInfo> sectionInfo = [[self.fetchedResultsController sections] objectAtIndex:section]; return [sectionInfo

numberOfRowsInSection: method for core data and multiple sections

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-19 13:08:09
问题 I am trying to show a table view with 2 sections. The first section will always have 1 row and the second section will have as many rows as data points. I am using Core Data and the following tableView:numberOfRowsInSection: method... - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { if (section == 0) { return 1; } else { id <NSFetchedResultsSectionInfo> sectionInfo = [[self.fetchedResultsController sections] objectAtIndex:section]; return [sectionInfo

'filenames are used to distinguish private declarations of the same name' error

为君一笑 提交于 2020-01-19 06:53:31
问题 I am getting this error on generating an NSManagedObject in Xcode 8.1 in Swift. :0: error: filename "DemoOne+CoreDataClass.swift" used twice: '/Users/Swasidhant/Desktop/demo again/DemoOne+CoreDataClass.swift' and '/Users/Swasidhant/Library/Developer/Xcode/DerivedData/demo_again-hiinrbwwbmyfbrbctsfdzvudkkuy/Build/Intermediates/demo again.build/Debug-iphonesimulator/demo again.build/DerivedSources/CoreDataGenerated/Model/DemoOne+CoreDataClass.swift' :0: note: filenames are used to distinguish

'filenames are used to distinguish private declarations of the same name' error

无人久伴 提交于 2020-01-19 06:53:08
问题 I am getting this error on generating an NSManagedObject in Xcode 8.1 in Swift. :0: error: filename "DemoOne+CoreDataClass.swift" used twice: '/Users/Swasidhant/Desktop/demo again/DemoOne+CoreDataClass.swift' and '/Users/Swasidhant/Library/Developer/Xcode/DerivedData/demo_again-hiinrbwwbmyfbrbctsfdzvudkkuy/Build/Intermediates/demo again.build/Debug-iphonesimulator/demo again.build/DerivedSources/CoreDataGenerated/Model/DemoOne+CoreDataClass.swift' :0: note: filenames are used to distinguish

Custom setter methods in Core-Data

旧时模样 提交于 2020-01-19 06:49:09
问题 I need to write a custom setter method for a field (we'll call it foo ) in my subclass of NSManagedObject . foo is defined in the data model and Xcode has autogenerated @property and @dynamic fields in the .h and .m files respectively. If I write my setter like this: - (void)setFoo: (NSObject *)inFoo { [super setFoo: inFoo]; [self updateStuff]; } then I get a compiler warning on the call to super . Alternatively, if I do this: - (void)setFoo: (NSObject *)inFoo { [super setValue: inFoo forKey: