core-data

How to update user interface on Core Data?

假如想象 提交于 2020-01-14 06:03:40
问题 I have an app with UITableView, Core Data and NSFetchedResultsController as well. I have passed data to the DetailViewController. And I can delete them from the DetailViewController! In the Apple's iOS Notes app, you can see such as functions as I wanted! When you delete a notes from the DetailViewController ( for example ), object deleted and Notes app automaticlly shows the next or previos notes! I want to create such as function. How update user interface after deleted current object? Here

what is best method for core data or sqlite for iphone app with using story board? [closed]

半城伤御伤魂 提交于 2020-01-14 05:58:31
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I want to make a small application that is based on database in back end as storage. I want to do my first CRUD operation as-well. kindly suggest your Best for small,intermediate or large application. 回答1: you should start with CORE DATA. Here is a link for one video tutorial, you can find them on your as-well.

Recent searches with Core Data

北城以北 提交于 2020-01-14 05:43:13
问题 I'm making a Core Data app for the iPhone, but hope the question applies enough to Mac OS X to be answered in that context with no NDA issues. When a user does a search, I am saving each result into a context using entity Entry. I want these results to be retrievable later under a Recent Searches section. What's the best way to go about this? One way I'm considering is add another entity named History with an Entry attribute linking to this. First search results would have Entry.history_id =

Update attribute when an object is added/removed from a relationship

有些话、适合烂在心里 提交于 2020-01-14 01:59:32
问题 Consider this model: @class Patient; @interface Hospital : NSManagedObject @property (nonatomic, retain) NSString * name; @property (nonatomic, retain) NSNumber * patientCount; @property (nonatomic, retain) NSSet *patients; @end @interface Hospital (CoreDataGeneratedAccessors) - (void)addPatientsObject:(Patient *)value; - (void)removePatientsObject:(Patient *)value; - (void)addPatients:(NSSet *)values; - (void)removePatients:(NSSet *)values; @end I want to update patientCount every time a

Core Data error: -[myclass encodeWithCoder:]: unrecognized selector sent to instance

半城伤御伤魂 提交于 2020-01-14 01:59:06
问题 I have a custom class MyClass that is essentially made up of several NSMutableArrays and no other variables. I have an entity MyEntity that has an ivar that is of MyClass. When I try to save the entity, I get this stack dump: 0 CoreFoundation 0x0118ebe9 __exceptionPreprocess + 185 1 libobjc.A.dylib 0x012e35c2 objc_exception_throw + 47 2 CoreFoundation 0x011906fb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187 3 CoreFoundation 0x01100366 ___forwarding___ + 966 4 CoreFoundation 0x010fff22

Update attribute when an object is added/removed from a relationship

元气小坏坏 提交于 2020-01-14 01:57:28
问题 Consider this model: @class Patient; @interface Hospital : NSManagedObject @property (nonatomic, retain) NSString * name; @property (nonatomic, retain) NSNumber * patientCount; @property (nonatomic, retain) NSSet *patients; @end @interface Hospital (CoreDataGeneratedAccessors) - (void)addPatientsObject:(Patient *)value; - (void)removePatientsObject:(Patient *)value; - (void)addPatients:(NSSet *)values; - (void)removePatients:(NSSet *)values; @end I want to update patientCount every time a

How to fetch even and odd values from core data using Predicate

一曲冷凌霜 提交于 2020-01-13 20:28:50
问题 I want to fetch even and odd values from my core data entity, please look into below code and correct, because its crashing the app. NSPredicate *predicate; if ([leadFilter.rank isEqualToString:@"Even"]) { predicate = [NSPredicate predicateWithFormat:@"(street%2) = 0"]; } else predicate = [NSPredicate predicateWithFormat:@"street%2 != 0)"]; [predicateArray addObject:predicate]; Its saying unable to parse street%2=0. 回答1: You can do this directly in Core Data, but the syntax is a little hairy.

How to fetch even and odd values from core data using Predicate

不问归期 提交于 2020-01-13 20:28:41
问题 I want to fetch even and odd values from my core data entity, please look into below code and correct, because its crashing the app. NSPredicate *predicate; if ([leadFilter.rank isEqualToString:@"Even"]) { predicate = [NSPredicate predicateWithFormat:@"(street%2) = 0"]; } else predicate = [NSPredicate predicateWithFormat:@"street%2 != 0)"]; [predicateArray addObject:predicate]; Its saying unable to parse street%2=0. 回答1: You can do this directly in Core Data, but the syntax is a little hairy.

What are the correct bindings for an NSComboBox for use with Core Data

谁说胖子不能爱 提交于 2020-01-13 19:25:05
问题 Imagine if you will a Core Data app with two entities (Employee, and Department). Employees have a to-one relationship with department (department) and the inverse is a to-many relationship (employees). In the UI you can select individual Employee entities and edit the details in a detail area (there are of course other attributes and there is UI for adding and editing Department entities). When using a popup button the bindings are: content = PopUpArrayController.arrangedObjects content

Init method for core data entity not available

穿精又带淫゛_ 提交于 2020-01-13 18:11:09
问题 I am on xcode 6.1 and developing for iOS 8.1. I have simple project called CoreDataTest where I play around with core data. Model: import CoreData class Licence: NSManagedObject { @NSManaged var name: String } and Now I want to create a licence object. This is what I need prior to creating the object: let appDel:AppDelegate = UIApplication.sharedApplication().delegate as AppDelegate let context:NSManagedObjectContext = appDel.managedObjectContext! let ent = NSEntityDescription.entityForName(