core-data

Strange app crash on iPhone - not rejected by Apple

此生再无相见时 提交于 2020-01-04 05:42:15
问题 I recently submitted my app to Apple through iTunes Connect, and it is now in the iTunes store. However, when I downloaded it onto a friend's iPhone, it crashes immediately. I tested it on the iPhone simulator and my iPad (I don't have an iPhone). So, I plugged the iPhone into my computer and got this crash log from it: Incident Identifier: 893F48B6-9805-4BF7-BA84-D5CDF85392E8 CrashReporter Key: 72f4227f4240642bb75dcb75873b6f4b42cf3cf7 Hardware Model: iPhone3,1 Process: App [305] Path: /var

Error 133000 when using multiple contexts with core data

大憨熊 提交于 2020-01-04 05:03:06
问题 I've spent days trying every possible solution I can think of to this problem, but nothing seems to be working. I run a background thread like this: [MagicalRecord saveInBackgroundWithBlock:^(NSManagedObjectContext *localContext) { Media *localMedia = [media inContext:localContext]; UIImage *image = localMedia.thumbnail; dispatch_async(dispatch_get_main_queue(), ^{ [thumbnails setObject:image forKey:[NSNumber numberWithInt:i]]; [contentDict setObject:thumbnails forKey:@"MediaItems"]; [cell

NSFetchedResultsController not sorting on encrypted attributes

北慕城南 提交于 2020-01-04 03:52:26
问题 I am trying to encrypt the attributes in my Core Data model using the transformable type but am experiencing a lot of issues trying to fetch back results once data has been persisted to the sqlite db. My main application for Core Data is to store some user related data and fetch it back again sorted by first name, last name etc and then display it in a table view using the first letter of first/last name as the section header. It seems that the encryption is interfering with the results

NSFetchedResultsController not sorting on encrypted attributes

笑着哭i 提交于 2020-01-04 03:52:06
问题 I am trying to encrypt the attributes in my Core Data model using the transformable type but am experiencing a lot of issues trying to fetch back results once data has been persisted to the sqlite db. My main application for Core Data is to store some user related data and fetch it back again sorted by first name, last name etc and then display it in a table view using the first letter of first/last name as the section header. It seems that the encryption is interfering with the results

sqlite file is empty when send it via MFMailcomposeController

爷,独闯天下 提交于 2020-01-04 03:05:19
问题 I want to send the coreData sqlite file via mail NSURL *appDoc = [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject]; NSURL *storeURL = [appDoc URLByAppendingPathComponent:@"Log.sqlite"]; NSData *sqliteData = [[NSData alloc] initWithContentsOfURL:storeURL]; MFMailComposeViewController * mailComposeVC = [[MFMailComposeViewController alloc] init]; [mailComposeVC addAttachmentData:sqliteData mimeType:@"application/x-sqlite3" fileName:@

Core Data validation: from Objective-C to Swift

我的梦境 提交于 2020-01-04 02:54:32
问题 I'm building a dummy iOS project in order to understand how to implement validation in Core Data with Swift. The Core Data model of the project has one entity called Person that contains two attributes: firstName and lastName . The project is based on Swift but, in order to start it, I'm using Objective-C to define the NSManagedObject subclass: Person.h @interface Person : NSManagedObject @property (nonatomic, retain) NSString *firstName; @property (nonatomic, retain) NSString *lastName; @end

Core Data validation: from Objective-C to Swift

依然范特西╮ 提交于 2020-01-04 02:54:07
问题 I'm building a dummy iOS project in order to understand how to implement validation in Core Data with Swift. The Core Data model of the project has one entity called Person that contains two attributes: firstName and lastName . The project is based on Swift but, in order to start it, I'm using Objective-C to define the NSManagedObject subclass: Person.h @interface Person : NSManagedObject @property (nonatomic, retain) NSString *firstName; @property (nonatomic, retain) NSString *lastName; @end

iOS: Swift: Core Data: Error: +entityForName: nil is not a legal NSManagedObjectContext parameter searching for entity name

安稳与你 提交于 2020-01-04 02:41:07
问题 I used Core Data for a table view with Swift Language. It can launch successfully, but after clicking Done button in AddView, there is an error: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+entityForName: nil is not a legal NSManagedObjectContext parameter searching for entity name 'OneItemCD'' I don't know why. Could anybody help me figure it out? Thanks very much! Here is the code. There is an add bar button item. Clicking this button transfer to

Complex sorting for core-data fetch request

天涯浪子 提交于 2020-01-04 02:35:07
问题 I have an NSEntity ( Cloth ) with an attribute ( type ) which is filled from a list of predefined NSString values i.e. Poncho‎, Jacket, Coat, Gown, Top, Suit, etc. I want to fetch all the Cloth records such that the records are ordered based on a defined order for type . i.e. All the records for Poncho‎ are on top, then Jacket, then Coat, then Gown, then Top, then Suit, etc. Poncho‎ … Poncho‎ … Poncho‎ … Jacket … Jacket … Coat … Coat … Coat … Gown … Gown … Top … Top … Top … Top … Suit … Suit

Can two managed object context share one single persistent store coordinator?

爷,独闯天下 提交于 2020-01-04 02:18:09
问题 Example: I have one persistent store coordinator which uses one single persistent store. Now there are two managed object contexts, and both want to use the same persistent store. Could both simply use the same persistent store coordinator, or would I have to create two instances of NSPersistentStoreCoordinator? And if I had to, then: Would I also have to create two NSPersistentStore instances? 回答1: The Core Data on iPhone article on ADC gives a good introduction to this topic: In any