Search Results

Search found 215 results on 9 pages for 'coredata'.

Page 4/9 | < Previous Page | 1 2 3 4 5 6 7 8 9  | Next Page >

  • Getting sectionNameKeyPath to work with CoreData/UITableViewController

    - by Elon
    In my AppDelegate I create an NSFetchedResultsController with sectionNameKeyPath set to @"group". In viewWillAppear in my TableViewController I performFetch, then call a method called findGroups. findGroups does some complicated analysis of the entire dataset to identify groups, then sets the "group" transient property on each object to the correct string value. I can see with NSLog that these are all set correctly and in coherent groups. But, tinker as I may, my cells are shown in a single section with the title of the first group. Any ideas?

    Read the article

  • Updating CoreData xcdatamodel file troubles - attribute type change

    - by San
    I noticed several questions related to this topic go unanswered. Is this such a gray area that nobody really understands it? Here is my problem: I am a midway in the development of my app and the app has never been used ouside of my iphone simulator.One of the attributes in my core data structure requires a type change.Since my app has never been used outside of my iPhone Simulator, I first deleted the sqlite file. Doubling the effort of this step, I also went into iPhone Simulator menu and selected "Reset Content and Settings...". Than, I edited the xcdatamodel file and changed the type of my attribute. I saved the file and exited. Without any other changes, I compiled. I expected it to fail because of my type change. It did not! After this, I assigned a value with new type to my attribute and it fails to compile?! Is there something else that I need to do for the change to take an effect? I would really, really appreciate an answer to my question. Thank you!

    Read the article

  • [Cocoa] CoreData bindings for NSPopupButton

    - by ndg
    I'm looking to use a dropdown menu (possibly an NSPopupButton object) to represent the hierarchical results of two Core Data entities (Genre and Movie) and their relationships. In my current data model, my Genre entity has a one-to-many relationship with my Movie entity. What I'm now looking to do is generate the contents of an NSPopupButton to show a hierarchical list of Genres and the Movies associated with them, like so: Genre 1 Film 1 Film 2 Genre 2 Film 3 Film 4 Note that, in the above example, only Movie objects are to be selectable by the user (Genre objects will appear, but be unselectable). Also, to complicate matters slightly, I have an additional NSPopupButton which lists Movie Rental locations. The location selected by the user ultimately impacts on the genres and films available in the second dropdown. I imagine that bindings will only take me so far with this problem and that, ultimately, I'll have to populate the contents of the dropdown menu myself. I'm posting here for thoughts and opinions on the best way to go about this.

    Read the article

  • CoreData many-to-many relationship NSPredicate Exceptions

    - by user307550
    I'm trying to model a Person/Team relationship. It's a many to many relationship since a person can belong to multiple teams and a team can have multiple people. As suggested by the doc I created an intermediate entity called TeamMember. I am now trying to run a query to see if I have a list of people, whether a pre-existing Team already exists for them so I'm not storing duplicate Teams in the database NSFetchRequest *request = [[[NSFetchRequest alloc] init] autorelease]; NSEntityDescription *entity = [NSEntityDescription entityForName:@"Team" inManagedObjectContext:[pm managedObjectContext]]; [request setEntity:entity]; NSPredicate *predicate = nil; predicate = [NSPredicate predicateWithFormat:@"ALL %K IN %@", @"teamMembers.person", players]; players is an NSSet of people that I'm trying to search I'm getting the following exception: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unsupported predicate ALL teamMembers.person IN { (entity: Person; id: 0x1334470 ; data: { Ideally I would like them to match exactly and not just do an IN as well. Any help would be greatly appreciated

    Read the article

  • RestKit : Not able to perform mapping using coredata

    - by Ashish Beuwria
    I'm using rest kit 0.20.3 and Xcode 5. Without core data I'm able to perform all rest kit operation, but when I've tried it with core data, I'm not even able to perform GET due to some problem. I can't figure it out. I'm new with core data. So pls help. Here is my code: AppDelegate.m @implementation CardGameAppDelegate @synthesize managedObjectContext = _managedObjectContext; @synthesize managedObjectModel = _managedObjectModel; @synthesize persistentStoreCoordinator = _persistentStoreCoordinator; - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { RKLogConfigureByName("RestKit", RKLogLevelWarning); RKLogConfigureByName("RestKit/ObjectMapping", RKLogLevelTrace); RKLogConfigureByName("RestKit/Network", RKLogLevelTrace); RKObjectManager *objectManager = [RKObjectManager managerWithBaseURL:[NSURL URLWithString:@"http://192.168.1.3:3010/"]]; RKManagedObjectStore *objectStore = [[RKManagedObjectStore alloc] initWithManagedObjectModel:self.managedObjectModel]; objectManager.managedObjectStore = objectStore; RKEntityMapping *playerMapping = [RKEntityMapping mappingForEntityForName:@"Player" inManagedObjectStore:objectStore]; [playerMapping addAttributeMappingsFromDictionary:@{@"id": @"playerId", @"name": @"playerName", @"age" : @"playerAge", @"created_at": @"createdAt", @"updated_at": @"updatedAt"}]; RKResponseDescriptor *responseDesc = [RKResponseDescriptor responseDescriptorWithMapping:playerMapping method:RKRequestMethodGET pathPattern:@"/players.json" keyPath:nil statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)]; [objectManager addResponseDescriptor:responseDesc]; PlayersTableViewController *ptvc = (PlayersTableViewController *)self.window.rootViewController; ptvc.managedObjectContext = self.managedObjectContext; return YES; } and code for playerTableViewController.h #import <UIKit/UIKit.h> @interface PlayersTableViewController : UITableViewController <NSFetchedResultsControllerDelegate> @property (strong, nonatomic) NSFetchedResultsController *fetchedResultsController; @property (strong, nonatomic) NSManagedObjectContext *managedObjectContext; @end and PlayerTableViewController.m get method: -(void)loadPlayers{ [[RKObjectManager sharedManager] getObjectsAtPath:@"/players.json" parameters:nil success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult){ [self.refreshControl endRefreshing]; } failure:^(RKObjectRequestOperation *operation, NSError *error) { [self.refreshControl endRefreshing]; UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"An Error Has Occurred" message:[error localizedDescription] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alertView show]; }]; } I'm getting the following error : Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Unable to perform mapping: No `managedObjectContext` assigned. (Mapping response.URL = http://192.168.1.3:3010/players.json)'

    Read the article

  • Passing row from UIPickerView to integer CoreData attribute

    - by Gordon Fontenot
    I'm missing something here, and feeling like an idiot about it. I'm using a UIPickerView in my app, and I need to assign the row number to a 32-bit integer attribute for a Core Data object. To do this, I am using this method: -(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component { object.integerValue = row; } This is giving me a warning: warning: passing argument 1 of 'setIntegerValue:' makes pointer from integer without a cast What am I mixing up here? --EDIT 1-- Ok, so I can get rid of the errors by changing the method to do the following: NSNumber *number = [NSNumber numberWithInteger:row]; object.integerValue = rating; However, I still get a value of 0 for object.integerValue if I use NSLog to print it out. object.integerValue has a max value of 5, so I print out number instead, and then I'm getting a number above 62,000,000. Which doesn't seem right to me, since there are 5 rows. If I NSLog the row variable, I get a number between 0 and 5. So why do I end up with a completely different number after casting the number to NSNumber?

    Read the article

  • Binding CoreData Managed Object to NSTextFieldCell subclass

    - by ndg
    I have an NSTableView which has its first column set to contain a custom NSTextFieldCell. My custom NSTextFieldCell needs to allow the user to edit a "desc" property within my Managed Object but to also display an "info" string that it contains (which is not editable). To achieve this, I followed this tutorial. In a nutshell, the tutorial suggests editing your Managed Objects generated subclass to create and pass a dictionary of its contents to your NSTableColumn via bindings. This works well for read-only NSCell implementations, but I'm looking to subclass NSTextFieldCell to allow the user to edit the "desc" property of my Managed Object. To do this, I followed one of the articles comments, which suggests subclassing NSFormatter to explicitly state which Managed Object property you would like the NSTextFieldCell to edit. Here's the suggested implementation: @implementation TRTableDescFormatter - (BOOL)getObjectValue:(id *)anObject forString:(NSString *)string errorDescription:(NSString **)error { if (anObject != nil){ *anObject = [NSDictionary dictionaryWithObject:string forKey:@"desc"]; return YES; } return NO; } - (NSString *)stringForObjectValue:(id)anObject { if (![anObject isKindOfClass:[NSDictionary class]]) return nil; return [anObject valueForKey:@"desc"]; } - (NSAttributedString*)attributedStringForObjectValue:(id)anObject withDefaultAttributes:(NSDictionary *)attrs { if (![anObject isKindOfClass:[NSDictionary class]]) return nil; NSAttributedString *anAttributedString = [[NSAttributedString alloc] initWithString: [anObject valueForKey:@"desc"]]; return anAttributedString; } @end I assign the NSFormatter subclass to my cell in my NSTextFieldCell subclass, like so: - (void)awakeFromNib { TRTableDescFormatter *formatter = [[[TRTableDescFormatter alloc] init] autorelease]; [self setFormatter:formatter]; } This seems to work, but falls down when editing multiple rows. The behaviour I'm seeing is that editing a row will work as expected until you try to edit another row. Upon editing another row, all previously edited rows will have their "desc" value set to the value of the currently selected row. I've been doing a lot of reading on this subject and would really like to get to the bottom of this. What's more frustrating is that my NSTextFieldCell is rendering exactly how I would like it to. This editing issue is my last obstacle! If anyone can help, that would be greatly appreciated.

    Read the article

  • Can't set default value of string property to "" in the Xcode CoreData model designer

    - by glenc
    I have an entity in my datamodel with a string property that is currently optional, and I'd like to convert this property to a required property with a default value of the empty string. As others have discovered, leaving the default value blank results in validation errors (since the designer interprets this as NULL), but trying '', "", or @"" as the default value results in those literal characters being interpreted as the default, rather than the empty zero-length string, as desired. I did find this thread on Google, however, apart from the solution being really ugly (model definition split between the .xcdatamodel and objc source), it also doesn't work for lightweight migrations because those migrations are done solely based on the .xcdatamodel files and the objc logic from your entity implementations isn't loaded. Is there any way to achieve this in the data model designer?

    Read the article

  • [Cocoa] Binding CoreData Managed Object to NSTextFieldCell subclass

    - by ndg
    I have an NSTableView which has its first column set to contain a custom NSTextFieldCell. My custom NSTextFieldCell needs to allow the user to edit a "desc" property within my Managed Object but to also display an "info" string that it contains (which is not editable). To achieve this, I followed this tutorial. In a nutshell, the tutorial suggests editing your Managed Objects generated subclass to create and pass a dictionary of its contents to your NSTableColumn via bindings. This works well for read-only NSCell implementations, but I'm looking to subclass NSTextFieldCell to allow the user to edit the "desc" property of my Managed Object. To do this, I followed one of the articles comments, which suggests subclassing NSFormatter to explicitly state which Managed Object property you would like the NSTextFieldCell to edit. Here's the suggested implementation: @implementation TRTableDescFormatter - (BOOL)getObjectValue:(id *)anObject forString:(NSString *)string errorDescription:(NSString **)error { if (anObject != nil){ *anObject = [NSDictionary dictionaryWithObject:string forKey:@"desc"]; return YES; } return NO; } - (NSString *)stringForObjectValue:(id)anObject { if (![anObject isKindOfClass:[NSDictionary class]]) return nil; return [anObject valueForKey:@"desc"]; } - (NSAttributedString*)attributedStringForObjectValue:(id)anObject withDefaultAttributes:(NSDictionary *)attrs { if (![anObject isKindOfClass:[NSDictionary class]]) return nil; NSAttributedString *anAttributedString = [[NSAttributedString alloc] initWithString: [anObject valueForKey:@"desc"]]; return anAttributedString; } @end I assign the NSFormatter subclass to my cell in my NSTextFieldCell subclass, like so: - (void)awakeFromNib { TRTableDescFormatter *formatter = [[[TRTableDescFormatter alloc] init] autorelease]; [self setFormatter:formatter]; } This seems to work, but is extremely patch. On occasion, clicking to edit a row will cause its value to nullify. On other occasions, the value you enter on one row will populate other rows within the table. I've been doing a lot of reading on this subject and would really like to get to the bottom of this. What's more frustrating is that my NSTextFieldCell is rendering exactly how I would like it to. This editing issue is my last obstacle! If anyone can help, that would be greatly appreciated.

    Read the article

  • coredata using old file version on device

    - by Martin KS
    This is a follow on from my previous problems here. Resetting the simulator solved all my troubles before, and I've gone on to complete my App. I now have the exact same problem when installing the app onto my iPhone device. It picks up an old version of my database, which doesn't have the second entity in it, and crashes when I try to access the second entity: 2010-04-22 23:52:18.860 albumCloud[135:207] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '+entityForName: could not locate an NSManagedObjectModel for entity name 'Image'' 2010-04-22 23:52:18.874 albumCloud[135:207] Stack: ( 843263261, 825818644, 820669213, 20277, 844154820, 16985, 14633, 844473760, 844851728, 862896011, 843011267, 843009055, 860901832, 843738160, 843731504, 11547, 11500 ) terminate called after throwing an instance of 'NSException' I have two questions: 1) How on earth do I delete my app thoroughly enough from my phone that it removes the old data? (I've so far tried regular app deletion, deleting and then holding home and power for a reboot, cursing at and threatening the app while running it... everything) 2) How do I prevent this happening when my application is in the App store, and I for some reason decide that I want to add another entity to the store, or another attribute to the existing entities? is there an "if x doesn't exist then create it" method?

    Read the article

  • CoreData NSFetchedResultsController Empty Section Display

    - by user280390
    Hello I would like to show a fixed number of sections in a table view with a Fetched Results Controller as the data source. If you image the contacts app where sections organised by the alphabet, it will not have a header for B if there are no contacts in that section, so the section headers you see are A then C. I would like to display a section header in my table (for B), but without any rows. an empty section in effect. Can NSFetchedResultsController do this for me?

    Read the article

  • CoreData : App crashes when deleting last instance created

    - by Leo
    Hello, I have a 2 tabs application. In the first one, I'm creating objects of the "Sample" and "SampleList" entities. Each sampleList contains an ID and a set of samples. Each sample contains a date and temperature property. In the second tab, I'm displaying my data in a tableView. I implemented the - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath method in order to delete SampleLists. In my xcdatamodel the delete rule for my relationship between SampleList and Sample is Cascade. My problem is that when I try to delete SampleList I just created, the app crashes and I receive a EXC_BAD_ACCESS signal. If I restart it, then I'm able to delete "old" sampleList without any problems. Earlier, I had the following problem : I couldn't display the the sampleLists I created since I launched the app, because it crashed too. I received also the EXC_BAD_ACCESS signal. Actually, it seemed that the date of the last sample created of the set was nil. If I am not releasing the NSDate I'm using to set the sample's date, I don't have this problem anymore... If anyone could help me to find out what could cause my troubles it would be great !! Here is the method I'm using to create new instances : SampleList *newSampleList = (SampleList *)[NSEntityDescription insertNewObjectForEntityForName:@"SampleList" inManagedObjectContext:managedObjectContext]; [newSampleList setPatchID:patchID]; NSMutableSet *newSampleSet = [[NSMutableSet alloc] init]; NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; for (int i = 0; i < [byteArray count]; i=i+4, sampleCount++) { NSDateComponents *comps = [[NSDateComponents alloc] init]; [comps setYear:year]; [comps setMonth:month]; [comps setDay:day]; [comps setHour:hours]; [comps setMinute:minutes]; NSDate *sampleDate = [gregorian dateFromComponents:comps]; Sample *newSample = (Sample *)[NSEntityDescription insertNewObjectForEntityForName:@"Sample" inManagedObjectContext:managedObjectContext]; [newSample setSampleDate:sampleDate]; [newSample setSampleTemperature:[NSNumber numberWithInt:temperature]]; [newSampleSet addObject:newSample]; [comps release]; //[sampleDate release]; } [newSampleList setSampleSet:newSampleSet]; // [newSampleSet release]; NSError *error; if (![managedObjectContext save:&error]) { NSLog(@"Could not Save the context !!"); } [gregorian release];

    Read the article

  • Connecting CoreData to my App on an iPhone Device

    - by Lauren Quantrell
    I apologize ahead of time for what I'm sure is a complete newbie lapse. Running my iPhone app on iPhone simulator - no problem. But I loaded the app on an iPhone device for the first time and it appears as if the SQLite database I'm using (NSManagedObjectContext) isn't connected or didn't upload. The app installs but with no data. How do I get it all to upload and work on the device? I appreciate any help. lq

    Read the article

  • iphone coredata fetch-request sorting

    - by satyam
    I'm using core data and fetching the results successfully. I've few questions regarding core data 1. When I add a record, will it be added at the end or at the start of entity. 2. I'm using following code to fetch the data. Array is being populated with all the records. But they are not in the same order as I entered records into entity. why? on what basis default sorting is used? NSFetchRequest* allLatest = [[NSFetchRequest alloc] init]; [allLatest setEntity:[NSEntityDescription entityForName:@"Latest" inManagedObjectContext:[self managedObjectContext]]]; NSError* error = nil; NSArray* records = [managedObjectContext executeFetchRequest:allLatest error:&error]; [allLatest release]; 3. The way that I enter the records, 1,2,3,4......... after some time, I want to delete the records that I entered first(i mean oldest data). Something like delete oldest two records. How to do it?

    Read the article

  • How to check if something is stored in CoreData

    - by Terrel Gibson
    Hi I want to be able to tore some information in core data and but i am unsure of how to check if the file was saved properly. I tried using NSLog but it returns null when its called. I have a dictionary which has a uniqueID and a title which I want to save. I pass this in along with the context of the database. I then sort the database to check if it has any duplicates or not, if not then I add the file. +(VacationPhoto*) photoWithFlickrInfo: (NSDictionary*) flickrInfo inManagedObjectContext: (NSManagedObjectContext*) context{ //returns the dictionary NSLog(@"Photo To Store =%@", flickrInfo); VacationPhoto * photo = nil; NSFetchRequest *request = [NSFetchRequest fetchRequestWithEntityName:@"VacationPhoto"]; request.predicate = [NSPredicate predicateWithFormat:@"uniqueID = %@", [flickrInfo objectForKey:FLICKR_PHOTO_ID]]; NSSortDescriptor * descriptor = [NSSortDescriptor sortDescriptorWithKey:@"title" ascending:YES]; request.sortDescriptors = [NSArray arrayWithObject:descriptor]; NSError *error = nil; NSArray *matches = [context executeFetchRequest:request error:&error]; if (!matches || [matches count] > 1) { // handle error } else if ( [matches count] == 0){ photo.title = [flickrInfo objectForKey:FLICKR_PHOTO_TITLE]; //Returns NULL when called NSLog(@"title = %@", photo.title); photo.uniqueID = [flickrInfo objectForKey:FLICKR_PHOTO_ID]; //Returns NULL when called NSLog(@"ID = %@", photo.uniqueID); } else { //If photo already exists this is called photo = [matches lastObject]; } return photo; }

    Read the article

  • XCode CoreData files not found/opening

    - by jAmi
    Hello, I am using the Xcode 3.1.4 that means SDK 3.1.2 The problem is that I cannot open .xcdatamodel (Core Data) file and I don't even get the Data Model option in Design Menu bar. When ever I double click and try to open the file, XCode gives me an error saying that it cannot find the file at (my project's path).Perhaps it was moved or deleted? , but the file exists at the same path. Please help me out as I haven't upgraded my system to Snow Leopard so cant use SDK 3.2 Regards jAmi

    Read the article

  • CoreData is saving model without the save: method being called

    - by chris
    I have a list of items with a plus button in the navigation bar that opens up a modal window containing a table of the models attributes, that displays a form when the table items are clicked (pretty standard form style). For some reason if I click the plus button to open the form to create a new model, then immediately click the done button, the person model is saved. The action linked to the done button does nothing but call on a delegate method notifying the personListViewController to close the window. The apple docs do state that the model is not saved after calling the insertNewObjectForEntityName: ... Simply creating a managed object does not cause it to be saved to a persistent store. The managed object context acts as a scratchpad. I am at a lost to why this is happening, but every time I click the done button I have a new blank item in the original tableView. I am using SDK v3.1.3 // PersonListViewController - open modal window - (void)addPerson { // Load the new form PersonNewViewController *newController = [[PersonNewViewController alloc] init]; newController.modalFormDelegate = self; [self presentModalViewController:newController animated:YES]; [newController release]; } // PersonFormViewController - (void)viewDidLoad { [super viewDidLoad]; if ( person == nil ) { MyAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate]; self.person = [NSEntityDescription insertNewObjectForEntityForName:@"Person" inManagedObjectContext:appDelegate.managedObjectContext]; } ... UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(done)]; self.navigationItem.rightBarButtonItem = doneButton; [doneButton release]; } - (IBAction) done { [self.modalFormDelegate didCancel]; } // delegate method in the original listViewController - (void) didCancel { [self dismissModalViewControllerAnimated:YES]; }

    Read the article

  • iPhone Coredata saving error

    - by satyam
    I'm trying to create core data application. Some times when trying to save data, i'm seeing following error: Error: NSInvalidArgumentException, Reason: * -_referenceData64 only defined for abstract class. Define -[NSTemporaryObjectID_default _referenceData64]!, Description: * -_referenceData64 only defined for abstract class. Define -[NSTemporaryObjectID_default _referenceData64]! I didn't understand why this error is coming and how to avoid it. Can some one help me please.

    Read the article

  • CoreData leak when reading a property

    - by Kamchatka
    Hello, I have the following code in a loop iterating over the different document objects: NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; [document primitiveValueForKey:@"data"]; [data writeToFile:filename atomically:NO]; [document.managedObjectContext refreshObject:document mergeChanges:NO]; [pool release]; The "data" property is a large blob (a 1MB image). And as I monitor the memory with the Allocation Instrument memory usage is increasing. I cannot find where the leak is coming from and how to remove it. Thanks!

    Read the article

  • IPhone CoreData: How should I relate many child entities to thier parents

    - by Robert
    I am trying to import data from a database that uses primary key / forign key relations to a core data database in Xcode. I have code that creates hundreds of child entities in a managed object context: Each child has an ID that corresponds to a parent. child1 parentID = 3 child2 parentID = 17 child3 parentID = 17 ... childn parentID = 5 I now need to relate each child to its parent. The parents are all stored in persistent memory. My first thought was to preform a fetch for each child to get its parent. However, I think this would be slow. Am I correct? How should I do this instead?

    Read the article

  • TableView doesnt show any Data(CoreData) - App crashe

    - by brush51
    Hey @all, i cant read my data from my database. I have an app with a tabbarcontroller. in the first tab the iphone camera takes a picture from a barcode and send the result to another view (CameraReturnDetailViewController). In CameraReturnDetailViewController is the savebutton, and here is the code from this save button: - (IBAction)saveAndQuitScan:(id) sender { XLog(@"saveAndQuitScan button wurde geklickt!"); ProjectQRCodeAppDelegate *appDelegate = [[UIApplication sharedApplication]delegate]; NSManagedObjectContext *context = [appDelegate managedObjectContext]; NSManagedObject *newData; newData = [NSEntityDescription insertNewObjectForEntityForName:@"BarcodeDaten" inManagedObjectContext:context]; [newData setValue:dataLabel.text forKey:@"Barcode_CD"]; NSError *error; [context save:&error]; //Aktuelle ansicht (self) animiert verlassen [self dismissModalViewControllerAnimated:YES]; // Nachdem die ansicht verlassen wurde, // auf das zweite Tab wechseln(scanverlauf) /** TO DO - Funktioniert noch nicht **/ [self.tabBarController setSelectedIndex:1]; } Now, my aim is to show the taba in the second tab, in a TableView (ScansViewController): - (void)viewDidLoad { [super viewDidLoad]; if (managedObjectContext_ == nil) { managedObjectContext_ = [(ProjectQRCodeAppDelegate *)[[UIApplication sharedApplication]delegate] managedObjectContext]; NSLog(@"After managedObjectContext: %@", managedObjectContext_); } myTableView = [[UITableView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame] style:UITableViewStylePlain]; myTableView.delegate = self; myTableView.dataSource = self; myTableView.autoresizesSubviews = YES; self.navigationItem.title = @"Code Liste"; self.view = myTableView; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [itemsList count]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease]; } return cell; } - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSString *selectDay = [NSString stringWithFormat:@"%d", indexPath.row]; TableDetailViewController *fvController = [[TableDetailViewController alloc] initWithNibName:@"TableDetailViewController" bundle:[NSBundle mainBundle]]; fvController.selectDay = selectDay; [self.navigationController pushViewController:fvController animated:YES]; [fvController release]; fvController = nil; } - (void) configureCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath { NSManagedObject *managedObject = [self.fetchedResultsController objectAtIndexPath:indexPath]; cell.textLabel.text = [[managedObject valueForKey:@"Barcode_CD"] description]; } - (NSFetchedResultsController *) fetchedResultsController { if (fetchedResultsController_ !=nil) { return fetchedResultsController_; } NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init]; NSEntityDescription *entity = [NSEntityDescription entityForName:@"BarcodeDaten" inManagedObjectContext:self.managedObjectContext]; [fetchRequest setEntity:entity]; [fetchRequest setFetchBatchSize:20]; NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"Barcode_CD" ascending:NO]; NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:sortDescriptor, nil]; [fetchRequest setSortDescriptors:sortDescriptors]; NSFetchedResultsController *aFetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:self.managedObjectContext sectionNameKeyPath:nil cacheName:@"Root"]; aFetchedResultsController.delegate = self; self.fetchedResultsController = aFetchedResultsController; [aFetchedResultsController release]; [fetchRequest release]; [sortDescriptor release]; [sortDescriptors release]; NSError *error = nil; if (![fetchedResultsController_ performFetch:&error]) { XLog(@"Error: %@, %@", error, [error userInfo]); abort(); } return fetchedResultsController_; } At first i get this error when i choosed the second tab(ScansViewController): " Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '+entityForName: could not locate an NSManagedObjectModel for entity name 'BarcodeDaten'' " The Name is correct but i dont understand my mistake. No data is showed in the Tableview, why? Have I missed something..? Or something wrong? Thanks for help, brush51

    Read the article

  • Endless saving of CoreData Context

    - by Robert
    Sometimes I noticed that a 'save:' operation an a ManagedObjectContext never returns and consumes 100% CPU. I'm using an SQL Store in a GarbageCollected environment (Mac OS X 10.6.3). The disk activity shows about 700 KB/s writing. While having a look at the folder that contains the sqlite database file the "-journal" file appears and disappears, appears and disappears, ... This is part of the call graph from the process analysis: 2203 -[NSManagedObjectContext save:] 1899 -[NSPersistentStoreCoordinator(_NSInternalMethods) executeRequest:withContext:] 1836 -[NSSQLCore executeRequest:withContext:] 1836 -[NSSQLCore saveChanges:] 1479 -[NSSQLCore performChanges] ... 335 -[NSSQLCore recordChangesInContext:] ... 20 -[NSSQLCore rollbackChanges] ... 2 -[NSSQLCore prepareForSave:] ... 62 -[NSPersistentStoreCoordinator(_NSInternalMethods) _checkRequestForStore:originalRequest:andOptimisticLocking:] ... 1 -[NSPersistentStore(_NSInternalMethods) _preflightCrossCheck] ... 184 -[NSMergePolicy resolveConflicts:] ... 120 -[NSManagedObjectContext(_NSInternalChangeProcessing) _prepareForPushChanges:] ... Everything a happening in the main GUI thread. Any ideas what I can to do to resolve the problem?

    Read the article

  • iphone coredata removing records between two entities connected by relation ship

    - by satyam
    I'm implementing core data in my iphone app. It has two entities. Entity1: LatestData Entity2: LatestDetailedData LatestData has URL, publishedDate, heading LatestDetailedData has URL, NewsDescription, PublishedDate, Author Both entities have same URL for a record. Both the entities are connected with inverse relation ship. And the relation ship is "delete-Cascaded" What I want: If I remove a record in LatestData, I want the record with same URL in LatestDetailedData must also be deleted. How?

    Read the article

  • Accessing CoreData relationships

    - by georgeliquor
    I have the following core data model with two entities: entity "item" which holds name, date, description and a to many relationship "image". image is optional. entity "image" holds url, name and relationship to one item. I load the executed Fetchrequest into this NSArray "entityArray" This is what I do to display my data in a UITableView for example to display title in main cell: NSManagedObject *object = (NSManagedObject *)[entityArray objectAtIndex:indexPath.row]; cell.textLabel.text=[object valueForKey:@"title"]; Now I have no clue how to access my relationship image ([object valueForKey:@"image"]), because it contains more than just a string.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9  | Next Page >