ios - Store UITableViewCell information into core data without segue xcode 5 -


I have a TableViewController and I have a UITableViewCell that can be expanded. When it is extended, I would like to save the data that was set with UIBarButtonItem, so this button will call a method for saving. I tried to save it in my ViewController implementation file but I always get an error:

  'NSInvalidArgumentException', Reason: 'NSPersistentStoreCoordinator can not be made with a model'   

I have copied all the necessary code from another project in my app djlett implementation file which is a basic project using basic data. I also created my xcdatamodeld file with an alarm unit and seven features. I have also created an NSManagedObject class for the unit, in addition to that I have an Alarmcel in which I set the UITTel electricity property.

My View Controller: The code is:

  - (IBAction) optionSet: (UIBarButtonItem *) sender {if ([_alarmOperation.title is equal: @ "save "]) [[Seven Alarmfinely]; }} BOOL monSet, tueSet, wedSet, thuSet, friSet, satset, sunset; - (Zero) Savelarmfinely {AlarmSecil * cell = [Tableview decoucere ripe cell with identifier: @ "alarmseal"]; If (cell.monteintakara == RGB (0, 204, 102)) {monSet = YES; } Else {monSet = NO; } If (cell.tue.tintcolor == RGB (0, 204, 102)) {tueSet = YES; } And {tueSet = NO; } If (cell.wed.tintColor == RGB (0, 204, 102)) {wedSet = YES; } Other {wedSet = NO; } If (cell.thuintintolor == RGB (0, 204, 102)) {thuSet = YES; } And {thuSet = NO; } If (cell.fri.tintColor == RGB (0, 204, 102)) {friSet = YES; } And {friSet = NO; } If (cell.sat.tintColor == RGB (0, 204, 102)) {session = yes; } Else {satSet = NO; } If (cell.sun.tintColor == RGB (0, 204, 102)) {sunSet = YES; } And {sun = no; } [Self Newslam: Monday: Somat Tuesday: Wednesday Wednesday: Wednesday Wednesday: Wednesday: Thursday Friday: Friday Saturday: Saturday Sunday: Sunshine]; NSFetchRequest * fetchRequest = [[NSFetchRequest alloc] initWithEntityName: @ "Alarm"]; NSError * requestError = Zero; AppDelegate * appDelegate = (AppDelegate *) [[UIApplication shared application] representative]; NSArray * Alarm = [[App Designate Managed Object Contains] executeFetchRequest: fetchRequest Error: & amp; Request error]; (BOOL) param Monday: (BOOL) param Monday: (BOOL) param Wednesday: (BOOL) paramWednesday Thursday: (BOOL) param Thursday: (BOOL) param Friday Saturday: (BOOL) param Saturday Sunday: (BOOL ) ParamSunday {BOOL Result = No; AppDelegate * appDelegate = (AppDelegate *) [[UIApplication shared application] representative]; Alarm * New Alarm = [NSEntityDescription insertNewObjectForEntityForName: Managed Object Contains in @ "Alarm": [AppDeset Managed Object Contains]]; If (new alarm == zero) {NSLog (@ "Failed to create new alarm"); no return; } NewAlarm.monday = [NSNumber numberWindul: Ultimate Monday]; NewAlarm.tuesday = [nsnumber number power: paratuse]; NewAlarm.wednesday = [nsnumber number power: paramount day]; NewAlarm.thursday = [NSNumber Number Powerful: Parammansu Day]; NewAlarm.friday = [NSNumber NumberBootball: Paraffard]; NewAlarm.saturday = [NSNumber Number Vithubals: Ultimate Saturdays]; NewAlarm.sunday = [NSNumber numberWithbull: superfine]; NSError * savingError = Zero; If ([Managed object contact save: & amp; saving error]) {return yes; } Else {NSLog (@ "Failed to save new alarm; error =% @", saving error); } Return results; }    

Your assumption is incorrect you should not call dequeueReusableCellWithIdentifier: on saving method It should be called only when the table wants to show the cell to the cell. In addition, cells should store any data, they should only inform their controller about the change and the controller should know what to do with the cell action. Alternatively, the cell should be connected to the model (alarm) and should be modified directly.

About your error with NSPersistentStoreCoordinator

Code> I think that you have [appDelegate managedObjectContext] And can save it later with self.managedObjectContext - perhaps the second, inappropriately started - is not a constant store set?

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -