Search Results

Search found 9486 results on 380 pages for 'core plot'.

Page 9/380 | < Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • Core Data and Relationships

    - by alku83
    I have two objects, a Trip and a Place. A Trip represents a journey from one Place to another Place, ie. a Trip needs a fromPlace and a toPlace. So, this is a 1-to-2 relationship, but I need to know which is the "from" and which is the "to". I am not sure how to model this in Core Data. I have created two entities (Trip, Place), and now I want to setup the relationship(s) so I have a fromPlace and a toPlace. Do I need to add an extra field on the Place entity called isFrom, or similar? If this was in a database, I would just have a id column on the Place table, and then two columns in the Trip table - fromPlaceId and toPlaceId. How do I achieve something similar in Core Data?

    Read the article

  • Adding single row one by one in tableview from core data of iPhone

    - by user336685
    I am working on RSS reader code where articles get downloaded and are viewable offline. The problem is only after all articles are downlaoded the tableview containing headlines gets updated. Core data is used. So everytime NSobjectcontext is saved , [self tableview updatebegins ] is called.The table is getting updated via fetchcontroller core data. I tried saving NSobjectcontext everytime an article is saved but that is not updating the tableview. I want a mechanism similar to instapaper tableview where articles get saved and tableview gets updated immediately. Please help if you know the solution. Thanks in advance.

    Read the article

  • How to view existing data in Core Data?

    - by mshsayem
    Well, may be this question is silly, but I couldn't find a way (except programmatically). I built a project (for iPhone OS 3.0) which uses Core Data. The xcdatamodel file shows the schema description, but I want to see the data in tabular form (like the management studio for mssql server or phpmyadmin for mysql). Is there any way (except coding)? What is that? Also, which file (in disk/device) those data are stored into? [ I built the tutorial (from apple) on Core Data, named Locations. They used this line somewhere in the code: NSURL *storeUrl = [NSURL fileURLWithPath: [[self applicationDocumentsDirectory] stringByAppendingPathComponent: @"Locations.sqlite"]]; But, I did not see any "xxxxx.sqlite" file in project location (nor in the disk).]

    Read the article

  • Core Data produces Analyzer warnings

    - by RickiG
    Hi I am doing the final touch ups on an app and I am getting rid of every compiler/analyzer warning. I have a bunch of Class methods that wrap my apps access to Core Data entities. This is "provoking" the analyzer. + (CDProductEntity*) newProductEntity { return (CDProductEntity*)[NSEntityDescription insertNewObjectForEntityForName:@"CDProductEntity" inManagedObjectContext:[self context]]; } Which results in an Analyzer warning: Object with +0 retain counts returned to caller where a +1 (owning) retain count is expected In the method that calls the above Class Method I have this: CDProductEntity *newEntity = [self newProductEntity]; Which results in an Analyzer warning: Method returns an Objective-C object with a +1 retain count (owning reference) Explicitly releasing or autoreleasing a Core Data entity is usually very very bad, but is that what it is asking me to do here? First it tells me it has a +0 retain count and that is bad, then it tells me it has a +1 which is also bad. What can I do to ensure that I am either dealing with a Analyzer hiccup or that I release correctly? Thanks in advance

    Read the article

  • EXC_MEMORY_ACCESS when trying to delete from Core Data ($cash solution)

    - by llloydxmas
    I have an application that downloads an xml file, parses the file, and creates core data objects while doing so. In the parse code I have a function called 'emptydatacontext' that removes all items from Core Data before creating replacements items from the xml data. This method looks like this: -(void) emptyDataContext { NSFetchRequest * allCon = [[NSFetchRequest alloc] init]; [allCon setEntity:[NSEntityDescription entityForName:@"Condition" inManagedObjectContext:managedObjectContext]]; NSError * error = nil; NSArray * conditions = [managedObjectContext executeFetchRequest:allCon error:&error]; DebugLog(@"ERROR: %@",error); DebugLog(@"RETRIEVED: %@", conditions); [allCon release]; for (NSManagedObject * condition in conditions) { [managedObjectContext deleteObject:condition]; } // Update the data model effectivly removing the objects we removed above. //NSError *error; if (![managedObjectContext save:&error]) { DebugLog(@"%@", [error domain]); } } The first time this runs it deletes all objects and functions as it should - creating new objects from the xml file. I created a 'update' button that starts the exact same process of retrieving the file the proceeding with the parse & build. All is well until its time to delete the core data objects. This 'deleteObject' call creates a "EXC_BAD_ACCESS" error each time. This only happens on the second time through. Captured errors return null. If I log the 'conditions' array I get a list of NSManagedObjects on the first run. On the second this log request causes a crash exactly as the deleteObject call does. I have a feeling it is something very simple I'm missing or not doing correctly to cause this behavior. The data works great on my tableviews - its only when trying to update I get the crashes. I have spent days & days on this trying numerous alternative methods. Whats left of my hair is falling out. I'd be willing to ante up some cash for anyone willing to look at my code and see what I'm doing wrong. Just need to get past this hurdle. Thanks in advance for the help!

    Read the article

  • Connection to .mdb file fails on windows 2008 core - 32bit

    - by amritad
    Hi, I have an application where I am doing connection with .mdb file. Here are the steps we are following : Creating object for database utils inteface Calling the connect() function, to get connected to the database whose extension is .mdb file Above flow is working correct on all windows platform but not on windows server 2008 CORE 32-bit. I also checked whether the ODBC drivers are installed or not, by opening regedit. I found that all drivers specially Microsoft access driver (*.mdb) is installed. ANd I think it is by default get installed while installing OS. Is anyone aware of any thing about ODBC drivers and connectivity to the database (like .mdb) on windows 2008 CORE ( which runs only on command line and no interface)

    Read the article

  • Core Data strategy using in memory cache, or no core data at all?

    - by randombits
    I have a user interface where the user can check off a bunch of items from a tableview, almost like a todo list. The items are populated from a Core Data stack. I need to be able to take all of the items they're clicking through and put them into a "temporary" shopping cart. Once they're in the shopping cart, users can go through the list and remove the items, or just submit them to a server. The thing is, the selected items are temporary just like an internet based shopping cart. It's nothing something that gets persisted once the application closes. Once the view is no longer in display, I can assume that the shopping cart is safe to discard. What's the best way to approach this? Since the user is essentially clicking on instances that map back to a Core Data entity .. should I setup a different persistence store such as in memory and add that store to my managed object context?

    Read the article

  • AMD Phenom II X2 555 BE, core unlock suddenly not working?

    - by user328271
    I've had a Phenom II X2 555 BE for around 2 - 3 years. When I got it, I immediately core unlocked it with my ECS A880GM-A3 mobo, which makes it turn into a Phenom II X4 B55. A few days ago, I installed Windows 7 64 bit to compensate for my 4 gigs of ram. When I start my system with its cores unlocked, it will restart after the BIOS screen. If I disable the core unlock, it boots to OS just fine. My question is: Does 64 bit OS makes a difference in core unlocking? Does my 3rd and 4th core burnt out? Also extra info: I tried core unlocking but keeping the 3rd and 4th core disabled and it still won't boot into OS. Could it be motherboard problems? Sorry for bad English. I will try to give additional information if needed. Thanks! Also it is worth mentioning I'm no computer expert but I tried to make my explanation as short as possible. I also asked my question on TomsHardware, but I had no answer till now so I decided to ask here too. anyone...?

    Read the article

  • Core Plot causing crash on device but not simulator.

    - by Eric
    I'm using core plot to create a small plot in one of my view controllers. I have been pulling my hair out trying to track down this error. I install on the simulator and it works fine but as soon as I put it on my device I get the following error: 2010-02-04 22:15:37.394 Achieve[127:207] *** -[NSCFString drawAtPoint:withTextStyle:inContext:]: unrecognized selector sent to instance 0x108530 2010-02-04 22:15:37.411 Achieve[127:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSCFString drawAtPoint:withTextStyle:inContext:]: unrecognized selector sent to instance 0x108530' 2010-02-04 22:15:37.427 Achieve[127:207] Stack: ( 843263261, 825818644, 843267069, 842763033, 842725440, 253481, 208187, 823956912, 823956516, 823956336, 823953488, 823952500, 823985628, 842717233, 843010887, 843009055, 860901832, 843738160, 843731504, 8797, 8692 ) terminate called after throwing an instance of 'NSException' Program received signal: “SIGABRT”. Debugger Output (as requested): #0 0x33b3db2c in __kill #1 0x33b3db20 in kill #2 0x33b3db14 in raise #3 0x33b54e3a in abort #4 0x33c5c398 in __gnu_cxx::__verbose_terminate_handler #5 0x313918a0 in _objc_terminate #6 0x33c59a8c in __cxxabiv1::__terminate #7 0x33c59b04 in std::terminate #8 0x33c59c2c in __cxa_throw #9 0x3138fe5c in objc_exception_throw #10 0x32433bfc in -[NSObject doesNotRecognizeSelector:] #11 0x323b8b18 in ___forwarding___ #12 0x323af840 in __forwarding_prep_0___ #13 0x0003de28 in -[CPTextLayer renderAsVectorInContext:] at CPTextLayer.m:117 #14 0x00032d3a in -[CPLayer drawInContext:] at CPLayer.m:146 #15 0x311c95b0 in -[CALayer _display] #16 0x311c9424 in -[CALayer display] #17 0x311c9370 in CALayerDisplayIfNeeded #18 0x311c8850 in CA::Context::commit_transaction #19 0x311c8474 in CA::Transaction::commit #20 0x311d05dc in CA::Transaction::observer_callback #21 0x323ad830 in __CFRunLoopDoObservers #22 0x323f5346 in CFRunLoopRunSpecific #23 0x323f4c1e in CFRunLoopRunInMode #24 0x335051c8 in GSEventRunModal #25 0x324a6c30 in -[UIApplication _run] #26 0x324a5230 in UIApplicationMain #27 0x0000225c in main at main.m:14 Here is my viewDidLoad method: - (void)viewDidLoad { [super viewDidLoad]; self.view.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"bg.png"]]; [self loadData]; self.graph = [[CPXYGraph alloc] initWithFrame: self.plotView.frame]; CPLayerHostingView *hostingView = self.plotView; hostingView.hostedLayer = graph; graph.paddingLeft = 50; graph.paddingTop = 10; graph.paddingRight = 10; graph.paddingBottom = 10; percentFormatter = [[NSNumberFormatter alloc] init]; [percentFormatter setPercentSymbol:@"%"]; [percentFormatter setNumberStyle:NSNumberFormatterPercentStyle]; [percentFormatter setLocale: [NSLocale currentLocale]]; [percentFormatter setMultiplier:[NSNumber numberWithInt:1]]; [percentFormatter setMaximumFractionDigits:0]; CPXYPlotSpace *plotSpace = (CPXYPlotSpace *)graph.defaultPlotSpace; plotSpace.xRange = [CPPlotRange plotRangeWithLocation:CPDecimalFromFloat(0) length:CPDecimalFromFloat(maxX)]; plotSpace.yRange = [CPPlotRange plotRangeWithLocation:CPDecimalFromFloat(minY) length:CPDecimalFromFloat(maxY-minY)]; CPLineStyle *lineStyle = [[CPLineStyle lineStyle]retain]; lineStyle.lineColor = [CPColor grayColor]; lineStyle.lineWidth = 1.0f; CPTextStyle *whiteText = [CPTextStyle textStyle]; whiteText.color = [CPColor whiteColor]; CPXYAxisSet *axisSet = (CPXYAxisSet *)graph.axisSet; // axisSet.xAxis.majorIntervalLength = [[NSDecimalNumber decimalNumberWithString:@"0"]decimalValue]; axisSet.xAxis.minorTicksPerInterval = 0; axisSet.xAxis.majorTickLineStyle = nil; axisSet.xAxis.minorTickLineStyle = nil; axisSet.xAxis.axisLineStyle = lineStyle; axisSet.xAxis.minorTickLength = 0; axisSet.xAxis.majorTickLength = 0; axisSet.xAxis.labelFormatter = nil; axisSet.xAxis.labelTextStyle = nil; axisSet.yAxis.majorIntervalLength = [[NSDecimalNumber decimalNumberWithString:intY]decimalValue]; axisSet.yAxis.minorTicksPerInterval = 5; axisSet.yAxis.majorTickLineStyle = lineStyle; axisSet.yAxis.minorTickLineStyle = lineStyle; axisSet.yAxis.axisLineStyle = lineStyle; axisSet.yAxis.minorTickLength = 2.0f; axisSet.yAxis.majorTickLength = 4.0f; axisSet.yAxis.labelFormatter = percentFormatter; axisSet.yAxis.labelTextStyle = whiteText; CPScatterPlot *xSquaredPlot = [[[CPScatterPlot alloc]initWithFrame:graph.defaultPlotSpace.graph.bounds] autorelease]; xSquaredPlot.identifier = @"Plot"; xSquaredPlot.dataLineStyle.lineWidth = 4.0f; xSquaredPlot.dataLineStyle.lineColor = [CPColor yellowColor]; xSquaredPlot.dataSource = self; [graph addPlot:xSquaredPlot]; } Any help would be appreciated!

    Read the article

  • How to populate a core data store programmatically?

    - by jdmuys
    I have ran out of hairs to pull with a crash in this routine that populates a core data store from a 9000+ line plist file. The crash happened at the very end of the routine inside the call to [managedObjectContext save:&error]. While if I save after every object insertion, the crash doesn't happen. Of course, saving after every object insertion totally kills the performance (from less than a second to many minutes). I modified my code so that it saves every K insertions, and the crash happens as soon as K = 2. The crash is an out-of-bound exception for an NSArray: Serious application error. Exception was caught during Core Data change processing: *** -[NSCFArray objectAtIndex:]: index (1) beyond bounds (1) with userInfo (null) Also maybe relevant, when the exception happen, my fetch result controller controllerDidChangeContent: delegate routine is in the call stack. It simply calls my table view endUpdate routine. I am now running out of ideas. How am I supposed to populate a core data store with a table view? Here is the call stack: #0 0x901ca4e6 in objc_exception_throw #1 0x01d86c3b in +[NSException raise:format:arguments:] #2 0x01d86b9a in +[NSException raise:format:] #3 0x00072cb9 in _NSArrayRaiseBoundException #4 0x00010217 in -[NSCFArray objectAtIndex:] #5 0x002eaaa7 in -[UITableView(_UITableViewPrivate) _endCellAnimationsWithContext:] #6 0x002def02 in -[UITableView endUpdates] #7 0x00004863 in -[AirportViewController controllerDidChangeContent:] at AirportViewController.m:463 #8 0x01c43be1 in -[NSFetchedResultsController(PrivateMethods) _managedObjectContextDidChange:] #9 0x0001462a in _nsnote_callback #10 0x01d31005 in _CFXNotificationPostNotification #11 0x00011ee0 in -[NSNotificationCenter postNotificationName:object:userInfo:] #12 0x01ba417d in -[NSManagedObjectContext(_NSInternalNotificationHandling) _postObjectsDidChangeNotificationWithUserInfo:] #13 0x01c03763 in -[NSManagedObjectContext(_NSInternalChangeProcessing) _createAndPostChangeNotification:withDeletions:withUpdates:withRefreshes:] #14 0x01b885ea in -[NSManagedObjectContext(_NSInternalChangeProcessing) _processRecentChanges:] #15 0x01bbe728 in -[NSManagedObjectContext save:] #16 0x000039ea in -[AirportViewController populateAirports] at AirportViewController.m:112 Here is the code to the routine. I apologize because a number of lines are probably irrelevant, but I'd rather err on that side. The crash happens the very first time it calls [managedObjectContext save:&error]: - (void) populateAirports { NSBundle *meBundle = [NSBundle mainBundle]; NSString *dbPath = [meBundle pathForResource:@"DuckAirportsBin" ofType:@"plist"]; NSArray *initialAirports = [[NSArray alloc] initWithContentsOfFile:dbPath]; //********************************************************************************* // get existing countries NSMutableDictionary *countries = [[NSMutableDictionary alloc] initWithCapacity:200]; NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init]; NSEntityDescription *entity = [NSEntityDescription entityForName:@"Country" inManagedObjectContext:managedObjectContext]; [fetchRequest setEntity:entity]; NSError *error = nil; NSArray *values = [managedObjectContext executeFetchRequest:fetchRequest error:&error]; if (!values) { NSLog(@"Unresolved error %@, %@", error, [error userInfo]); abort(); } int numCountries = [values count]; NSLog(@"We have %d countries in store", numCountries); for (Country *aCountry in values) { [countries setObject:aCountry forKey:aCountry.code]; } [fetchRequest release]; //********************************************************************************* // read airports int numAirports = 0; int numUnsavedAirports = 0; #define MAX_UNSAVED_AIRPORTS_BEFORE_SAVE 2 numCountries = 0; for (NSDictionary *anAirport in initialAirports) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; NSString *countryCode = [anAirport objectForKey:@"country"]; Country *thatCountry = [countries objectForKey:countryCode]; if (!thatCountry) { thatCountry = [NSEntityDescription insertNewObjectForEntityForName:@"Country" inManagedObjectContext:managedObjectContext]; thatCountry.code = countryCode; thatCountry.name = [anAirport objectForKey:@"country_name"]; thatCountry.population = 0; [countries setObject:thatCountry forKey:countryCode]; numCountries++; NSLog(@"Found %dth country %@=%@", numCountries, countryCode, thatCountry.name); } // now that we have the country, we create the airport Airport *newAirport = [NSEntityDescription insertNewObjectForEntityForName:@"Airport" inManagedObjectContext:managedObjectContext]; newAirport.city = [anAirport objectForKey:@"city"]; newAirport.code = [anAirport objectForKey:@"code"]; newAirport.name = [anAirport objectForKey:@"name"]; newAirport.country_name = [anAirport objectForKey:@"country_name"]; newAirport.latitude = [NSNumber numberWithDouble:[[anAirport objectForKey:@"latitude"] doubleValue]]; newAirport.longitude = [NSNumber numberWithDouble:[[anAirport objectForKey:@"longitude"] doubleValue]]; newAirport.altitude = [NSNumber numberWithDouble:[[anAirport objectForKey:@"altitude"] doubleValue]]; newAirport.country = thatCountry; // [thatCountry addAirportsObject:newAirport]; numAirports++; numUnsavedAirports++; if (numUnsavedAirports >= MAX_UNSAVED_AIRPORTS_BEFORE_SAVE) { if (![managedObjectContext save:&error]) { NSLog(@"Unresolved error %@, %@", error, [error userInfo]); abort(); } numUnsavedAirports = 0; } [pool release]; }

    Read the article

  • Adding Core Data to existing iPhone project

    - by swalkner
    I'd like to add core data to an existing iPhone project, but I still get a lot of compile errors: NSManagedObjectContext undeclared Expected specifier-qualifier-list before 'NSManagedObjectModel' ... I already added the Core Data Framework to the target (right click on my project under "Targets", "Add" - "Existing Frameworks", "CoreData.framework"). My header-file: NSManagedObjectModel *managedObjectModel; NSManagedObjectContext *managedObjectContext; NSPersistentStoreCoordinator *persistentStoreCoordinator; [...] @property (nonatomic, retain, readonly) NSManagedObjectModel *managedObjectModel; @property (nonatomic, retain, readonly) NSManagedObjectContext *managedObjectContext; @property (nonatomic, retain, readonly) NSPersistentStoreCoordinator *persistentStoreCoordinator; What am I missing? Starting a new project is not an option... Thanks a lot! edit sorry, I do have those implementations... but it seems like the Library is missing... the implementation methods are full with compile error like "managedObjectContext undeclared", "NSPersistentStoreCoordinator undeclared", but also with "Expected ')' before NSManagedObjectContext" (although it seems like the parenthesis are correct)... #pragma mark - #pragma mark Core Data stack /** Returns the managed object context for the application. If the context doesn't already exist, it is created and bound to the persistent store coordinator for the application. */ - (NSManagedObjectContext *) managedObjectContext { if (managedObjectContext != nil) { return managedObjectContext; } NSPersistentStoreCoordinator *coordinator = [self persistentStoreCoordinator]; if (coordinator != nil) { managedObjectContext = [[NSManagedObjectContext alloc] init]; [managedObjectContext setPersistentStoreCoordinator: coordinator]; } return managedObjectContext; } /** Returns the managed object model for the application. If the model doesn't already exist, it is created by merging all of the models found in application bundle. */ - (NSManagedObjectModel *)managedObjectModel { if (managedObjectModel != nil) { return managedObjectModel; } managedObjectModel = [[NSManagedObjectModel mergedModelFromBundles:nil] retain]; return managedObjectModel; } /** Returns the persistent store coordinator for the application. If the coordinator doesn't already exist, it is created and the application's store added to it. */ - (NSPersistentStoreCoordinator *)persistentStoreCoordinator { if (persistentStoreCoordinator != nil) { return persistentStoreCoordinator; } NSURL *storeUrl = [NSURL fileURLWithPath: [[self applicationDocumentsDirectory] stringByAppendingPathComponent: @"Core_Data.sqlite"]]; NSError *error = nil; persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]]; if (![persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeUrl options:nil error:&error]) { /* Replace this implementation with code to handle the error appropriately. abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. If it is not possible to recover from the error, display an alert panel that instructs the user to quit the application by pressing the Home button. Typical reasons for an error here include: * The persistent store is not accessible * The schema for the persistent store is incompatible with current managed object model Check the error message to determine what the actual problem was. */ NSLog(@"Unresolved error %@, %@", error, [error userInfo]); abort(); } return persistentStoreCoordinator; }

    Read the article

  • Freezes (not crashes) with GCD, blocks and Core Data

    - by Lukasz
    I have recently rewritten my Core Data driven database controller to use Grand Central Dispatch to manage fetching and importing in the background. Controller can operate on 2 NSManagedContext's: NSManagedObjectContext *mainMoc instance variable for main thread. this contexts is used only by quick access for UI by main thread or by dipatch_get_main_queue() global queue. NSManagedObjectContext *bgMoc for background tasks (importing and fetching data for NSFetchedresultsController for tables). This background tasks are fired ONLY by user defined queue: dispatch_queue_t bgQueue (instance variable in database controller object). Fetching data for tables is done in background to not block user UI when bigger or more complicated predicates are performed. Example fetching code for NSFetchedResultsController in my table view controllers: -(void)fetchData{ dispatch_async([CDdb db].bgQueue, ^{ NSError *error = nil; [[self.fetchedResultsController fetchRequest] setPredicate:self.predicate]; if (self.fetchedResultsController && ![self.fetchedResultsController performFetch:&error]) { NSSLog(@"Unresolved error in fetchData %@", error); } if (!initial_fetch_attampted)initial_fetch_attampted = YES; fetching = NO; dispatch_async(dispatch_get_main_queue(), ^{ [self.table reloadData]; [self.table scrollRectToVisible:CGRectMake(0, 0, 100, 20) animated:YES]; }); }); } // end of fetchData function bgMoc merges with mainMoc on save using NSManagedObjectContextDidSaveNotification: - (void)bgMocDidSave:(NSNotification *)saveNotification { // CDdb - bgMoc didsave - merging changes with main mainMoc dispatch_async(dispatch_get_main_queue(), ^{ [self.mainMoc mergeChangesFromContextDidSaveNotification:saveNotification]; // Extra notification for some other, potentially interested clients [[NSNotificationCenter defaultCenter] postNotificationName:DATABASE_SAVED_WITH_CHANGES object:saveNotification]; }); } - (void)mainMocDidSave:(NSNotification *)saveNotification { // CDdb - main mainMoc didSave - merging changes with bgMoc dispatch_async(self.bgQueue, ^{ [self.bgMoc mergeChangesFromContextDidSaveNotification:saveNotification]; }); } NSfetchedResultsController delegate has only one method implemented (for simplicity): - (void)controllerDidChangeContent:(NSFetchedResultsController *)controller { dispatch_async(dispatch_get_main_queue(), ^{ [self fetchData]; }); } This way I am trying to follow Apple recommendation for Core Data: 1 NSManagedObjectContext per thread. I know this pattern is not completely clean for at last 2 reasons: bgQueue not necessarily fires the same thread after suspension but since it is serial, it should not matter much (there is never 2 threads trying access bgMoc NSManagedObjectContext dedicated to it). Sometimes table view data source methods will ask NSFetchedResultsController for info from bgMoc (since fetch is done on bgQueue) like sections count, fetched objects in section count, etc.... Event with this flaws this approach works pretty well of the 95% of application running time until ... AND HERE GOES MY QUESTION: Sometimes, very randomly application freezes but not crashes. It does not response on any touch and the only way to get it back to live is to restart it completely (switching back to and from background does not help). No exception is thrown and nothing is printed to the console (I have Breakpoints set for all exception in Xcode). I have tried to debug it using Instruments (time profiles especially) to see if there is something hard going on on main thread but nothing is showing up. I am aware that GCD and Core Data are the main suspects here, but I have no idea how to track / debug this. Let me point out, that this also happens when I dispatch all the tasks to the queues asynchronously only (using dispatch_async everywhere). This makes me think it is not just standard deadlock. Is there any possibility or hints of how could I get more info what is going on? Some extra debug flags, Instruments magical tricks or build setting etc... Any suggestions on what could be the cause are very much appreciated as well as (or) pointers to how to implement background fetching for NSFetchedResultsController and background importing in better way.

    Read the article

  • UIView animation VS core animation

    - by Tom Irving
    I'm trying to animate a view sliding into view and bouncing once it hits the side of the screen. A basic example of the slide I'm doing is as follows: // The view is added with a rect making it off screen. [UIView beginAnimations:nil context:NULL]; [UIView setAnimationBeginsFromCurrentState:YES]; [UIView setAnimationDuration:0.07]; [UIView setAnimationCurve:UIViewAnimationCurveLinear]; [UIView setAnimationDelegate:self]; [UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)]; [theView setFrame:CGRectMake(-5, 0, theView.frame.size.width, theView.frame.size.height)]; [UIView commitAnimations]; More animations are then called in the didStopSelector to make the bounce effect. The problem is when more than one view is being animated, the bounce becomes jerky and, well, doesn't bounce anymore. Before I start reading up on how to do this in Core Animation, (I understand it's a little more difficult) I'd like to know if there is actually an advantage using Core Animation rather than UIView animations. If not, is there something I can do to improve performance?

    Read the article

  • Conversion from Iphone Core Surface RGB Frame into ffmepg AVFarme

    - by Sridhar
    Hello, I am trying to convert Core Surface RGB frame buffer(Iphone) to ffmpeg Avfarme to encode into a movie file. But I am not getting the correct video output (video showing colors dazzling not the correct picture) I guess there is something wrong with converting from core surface frame buffer into AVFrame. Here is my code : Surface *surface = [[Surface alloc]initWithCoreSurfaceBuffer:coreSurfaceBuffer]; [surface lock]; unsigned int height = surface.height; unsigned int width = surface.width; unsigned int alignmentedBytesPerRow = (width * 4); if (!readblePixels) { readblePixels = CGBitmapAllocateData(alignmentedBytesPerRow * height); NSLog(@"alloced readablepixels"); } unsigned int bytesPerRow = surface.bytesPerRow; void *pixels = surface.baseAddress; for (unsigned int j = 0; j < height; j++) { memcpy(readblePixels + alignmentedBytesPerRow * j, pixels + bytesPerRow * j, bytesPerRow); } pFrameRGB->data[0] = readblePixels; // I guess here is what I am doing wrong. pFrameRGB->data[1] = NULL; pFrameRGB->data[2] = NULL; pFrameRGB->data[3] = NULL; pFrameRGB->linesize[0] = pCodecCtx->width; pFrameRGB->linesize[1] = 0; pFrameRGB->linesize[2] = 0; pFrameRGB->linesize[3] = 0; sws_scale (img_convert_ctx, pFrameRGB->data, pFrameRGB->linesize, 0, pCodecCtx->height, pFrameYUV->data, pFrameYUV->linesize); Please help me out. Thanks, Raghu

    Read the article

  • Core Data Migration - "Can't add source store" error

    - by Tofrizer
    Hi, In my iPhone app I'm using Core Data and I've made changes to my data model that cannot be automatically migrated over (i.e. added new relationships). I added the data model version (Design - Data Model - Add Model Version) and applied my new data model changes to the new version 2. I then created a mapping object model and set the Source and Destination models to their correct data models (old and new respectively). When I run the app and call the persistentStoreCoordinator, my app barfs with the following: 2010-02-27 02:40:30.922 XXXX[73578:20b] Unresolved error Error Domain=NSCocoaErrorDomain Code=134110 UserInfo=0xfc2240 "Operation could not be completed. (Cocoa error 134110.)", { NSUnderlyingError = Error Domain=NSCocoaErrorDomain Code=134130 UserInfo=0xfbb3a0 "Operation could not be completed. (Cocoa error 134130.)"; reason = "Can't add source store"; } FWIW (not much i think) I've also made the usual code changes in persistentStoreCoordinator to use the NSMigratePersistentStoresAutomaticallyOption and NSInferMappingModelAutomaticallyOption (for future data model changes that can be automatically migrated). More relevantly, my managedObjectModel is created by calling initWithContentsOfURL where the file/resource type is "momd". I've tried updating both the source and destination model in the mapping model (Design - Mapping Model - Update XXX Model) as well as deleted the mapping model and recreated it. I've cleaned and re-built but all to no avail. I still get the above error message. Any pointers/thoughts on how I can further debug or resolve this problem please? I haven't posted any code snippets because this feels much more like a build environment issue (and my code is very standard - just the usual core data code to handle migrations using a mapping model but I'm happy to show the code if it helps). Appreciate any help. Thanks

    Read the article

  • Core data and @unionOfSets

    - by KevinD
    Im having trouble using the @unionOfSets on my core-data objects. NSLog(@"%@", [NSApp valueForKeyPath:@"delegate.mainWindowController.sidebarViewController.arrayController.selection.list.listElement"]); Prints the set of listElements as expected 2010-03-24 18:11:15.844 Pirouette[7459:80f] Relationship objects for {( (entity: PRPlaylistElement; id: 0x10a71b0 ; data: ), (entity: PRPlaylistElement; id: 0x10ac7d0 ; data: ), (entity: PRPlaylistElement; id: 0x10acf60 ; data: ), (entity: PRPlaylistElement; id: 0x10a6850 ; data: ) However when I try to get the set of file objects for each of the list elements. NSLog(@"%@", [NSApp valueForKeyPath:@"delegate.mainWindowController.sidebarViewController.arrayController.selection.list.listElement.@unionOfArrays.file"]); I get the following error 2010-03-24 18:16:45.843 Pirouette[7505:80f] An uncaught exception was raised 2010-03-24 18:16:45.844 Pirouette[7505:80f] [<NSCFSet 0x10415e0> valueForKeyPath:]: this class does not implement the unionOfArrays operation. 2010-03-24 18:16:45.847 Pirouette[7505:80f] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '[<NSCFSet 0x10415e0> valueForKeyPath:]: this class does not implement the unionOfArrays operation.' Confused because I thought calling to-many relationships in core-data were NSSets.

    Read the article

  • Image Wells, Core Data, and Sqlite files.

    - by Sway
    I've got a mac application that I've developed. I use it to create sqlite files that are bundled with my iphone app. The mac app uses Core Data and bindings and is working fine except for one "weird" issue. I use an NSImageView (or Image Well) to allow me to drag and drop jpg files. This is bound through to an optional binary attribute in my model class. For some reason when I drag and drop a 4k jpg file it onto the image well and save the sqlite file. The data saved to the binary column is over 15 times larger than it should be. Whereas if I use an application like SQLiteManager and add the image into the row in the database. The binary data is the correct (expected size). File 4k jpg Actual size: 2371. Persisted via Core Data size: 35810. Can anyone give me a suggestion as to why this might be happening? Do I need to set some setting in Interface Builder or write some custom code?

    Read the article

  • NSUndoManager with Core Data - Redo not working

    - by CJ
    I have a Core Data document-based app which support undo/redo via the built-in NSUndoManager associated with the NSManagedObjectContext. I have a few actions set up which perform numerous tasks within Core Data, wrap all these tasks into an undo group via beginUndoGrouping/endUndoGrouping, and are processed by the NSUndoManager. Undo works fine. I can perform several successive actions, and each then undo each one of them successively and my app's state is maintained correctly. However, the "Redo" menu item is never enabled. This means that the NSUndoManager is telling the menu that there are no items to redo. I am wondering why the NSUndoManager is seemingly forgetting about items once they are undone, and not allowing redos to occur? One thing I should mention is that I'm disabling undo registration after a document is opened/created. When I perform an action, I call enableUndoRegistration, beginUndoGrouping, perform the action, then call processPendingChanges, setActionName:, endUndoGrouping, and finally disableUndoRegistration. This makes sure that only specific actions are undoable, and any other data changes I make outside of these go unnoticed to the NSUndoManager. This may be a part of the issue, but if so I'm wondering why it's affecting redo? Thanks in advance.

    Read the article

  • Need some advice on Core Data modeling strategy

    - by Andy
    I'm working on an iPhone app and need a little advice on modeling the Core Data schema. My idea is a utility that allows the user to speed-dial their contacts using user-created rules based on the time of day. In other words, I would tell the app that my wife is commuting from 6am to 7am, at work from 7am to 4pm, commuting from 4pm to 5pm, and home from 5pm to 6am, Monday through Friday. Then, when I tap her name in my app, it would select the number to dial based on the current day and time. I have the user interface nearly complete (thanks in no small part to help I've received here), but now I've got some questions regarding the persistent store. The user can select start- and stop-times in 5-minute increments. This means there are 2,016 possible "time slots" in week (7 days * 24 hours * 12 5-minute intervals per hour). I see a few options for setting this up. Option #1: One array of time slots, with 2,016 entries. Each entry would be a dictionary containing a contact identifier and an associated phone number to dial. I think this means I'd need a "Contact" entity to store the contact information, and a "TimeSlot" entity for each of the 2,016 possible time slots. Option #2: Each Contact has its own array of time slots, each with 2,016 entries. Each array entry would simply be a string indicating which phone number to dial. Option #3: Each Contact has a dictionary of time slots. An entry would only be added to the dictionary for time slots with an active rule. If a search for, say, time slot 1,299 (Friday 12:15pm) didn't find a key @"1299" in the dictionary, then a default number would be dialed instead. I'm not sure any of these is the "right" way or the "best" way. I'm not even sure I need to use Core Data to manage it; maybe just saving arrays would be simpler. Any input you can offer would be appreciated.

    Read the article

  • Core Data - Entity Relationships Not Working as expected

    - by slimms
    I have set up my data model in xcode like so EntityA AttA1 AttA2 EntityB AttB1 AttB2 AttB3 I then set up the relationships EntityA Name: rlpToEntityB Destination: EntityB Inverse: rlpToEntityA To Many: Checked EntityB Name: rlpToEntityA Destination: EntityA Inverse: rlpToEntityB To Many: UnChecked i.e. relationship between the two where Each one of EntityA can have many EntityB's It is my understanding that if i fetch a subset of EntityB's I can then retrieve the values for the related EntityA's. I have this working so that i can retrieve the EntityB values using NSManagedObject *objMO = [fetchedResultsController objectAtIndexPath:indexPath]; strValueFromEntityB = [objMO valueForKey:@"AttB1"]; However, if I try to retrieve a related value from EntityA by doing the following strValueFromEntityA = [objMO valueForKey:@"AttA1"]; I get the error "The entity EntityB is not Key value coding-compliant for the key Atta1" Not surprisingly i suppose if i switch things around to fetch from EntityA i cannot access attributes of EntityB So it appears the defined relationshipare being ignored. Can anyone spot what i am doing wrong? I confess im very new to iPhone programming and especially to Core Data so please go easy on me and provide verbose explanations or point me in the direction a specific resource. I have downloaded the apple sample apps (Core Data Books, Top Songs and recipes) but I still can't work this out. Thanks in advance, Nev.

    Read the article

  • iPhone Core Data problem

    - by Junior B.
    This is my first project with Core Data, I followed the Event tutorial provided by Apple that helped me to understand the basic of core data in iPhone. But now, working over my project, I've a problem adding data into my database. When i create an object and set the data, if I try to get it back, the system returns me a strange sequence of characters. This is what i see in log if I try to log it: 2010-05-11 00:16:43.523 FG[2665:207] Package: ‡}00å 2010-05-11 00:16:43.525 FG[2665:207] Package: ‡}00å 2010-05-11 00:16:43.526 FG[2665:207] Package: ‡}00å 2010-05-11 00:16:43.527 FG[2665:207] Package: ‡}00å 2010-05-11 00:16:43.527 FG[2665:207] Package: ‡}00å 2010-05-11 00:16:43.527 FG[2665:207] Items: 5 What kind of problem could be this? Edit: This is the part of the code that generate the error: package = (Package *)[NSEntityDescription insertNewObjectForEntityForName:@"Package" inManagedObjectContext:moc]; theNodes = [doc nodesForXPath:@"//pack" error:&error]; for (CXMLElement *theElement in theNodes) { // Create a counter variable as type "int" int counter; // Loop through the children of the current node for(counter = 0; counter < [theElement childCount]; counter++) { if([[[theElement childAtIndex:counter] name] isEqualToString: @"id"]) [package setIdPackage:[[theElement childAtIndex:counter] stringValue]]; if([[[theElement childAtIndex:counter] name] isEqualToString: @"title"]) [package setPackageTitle:[[theElement childAtIndex:counter] stringValue]]; if([[[theElement childAtIndex:counter] name] isEqualToString: @"category"]) [package setCategory:[[theElement childAtIndex:counter] stringValue]]; if([[[theElement childAtIndex:counter] name] isEqualToString: @"lang"]) [package setLang:[[theElement childAtIndex:counter] stringValue]]; if([[[theElement childAtIndex:counter] name] isEqualToString: @"number"]) { NSNumberFormatter * f = [[NSNumberFormatter alloc] init]; [f setNumberStyle:NSNumberFormatterDecimalStyle]; NSNumber * myNumber = [f numberFromString:[[theElement childAtIndex:counter] stringValue]]; [f release]; [package setNumber:myNumber]; } } } NSLog([NSString stringWithFormat:@"=== %s ===\nID: %s\nCategory: %s\nLanguage: %s",[package packageTitle], [package idPackage] ,[package category],[package lang]]);

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >