Search Results

Search found 9231 results on 370 pages for 'core unlock'.

Page 17/370 | < Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >

  • Core Data: fetch an NSManagedObject by its properties

    - by niklassaers
    Hi guys, I have an object NetworkMember that has no attributes but is defined by its relationships Person, Network, Level and Role. In my app, I've found all the four relationships, but I want to make sure not to double-register my NetworkMember, thus I'd like to search for this NSManagedObject before instantiating it. How should I write a query that queries for an NSManagedObject just consisting of relationships? Cheers Nik

    Read the article

  • How do I query/filter a to-many relationship in Core Data

    - by Kris Bixler
    I have Customer, Event and Address objects in my data model. Both Customer and Address have a one-to-many relationship to Event. I can get the distinct list of addresses for a customer's events for by doing this: NSSet *addressSet = [customer valueForKeyPath:@"events.address"]; For the part of the UI I'm working on now, I need to display the address from the most recent event prior to now that has an address. I'm starting to go down the path of creating a NSFetchRequest, setting it's entity, sort descriptors, predicate and then looping through the results, but it seems like a lot of code. Am I missing some obvious way of filtering/sorting on the "events" relationship of the Customer object or is creating the NSFetchRequest the best solution?

    Read the article

  • Core Data - Relationship to dissimilar entities

    - by carotene
    Suppose I have the following data model: Entity Person Attribute name String Attribute personType String Attribute dailyRecords Entity CarpenterDailyRecord Attribute numberOfNailsHammered Int Attribute picNameOfFinishedCabinet String Entity WindowWasherDailyRecord Attribute nameOfBuildingWashed String Attribute numberOfWindowsWashed Int I would like to establish a to-many relationship between the Person.dailyRecords and 1 of the daily record entities (which changes depending on the person type). Of course, i could create a CarpenterPerson and WindowWasher entity which each points to it's unique daily record structure, but i have to group people together in my app somehow. so if i do a Group Entity: Entity Group Attribute people array i'm still stuck. how do i point to multiple & different Person entities? There must be an obvious answer, it's just i'm so new to all of this. thanks!

    Read the article

  • Implement delegates for Core Data's fetched results controller or not

    - by Spanky
    What advantage is there to implementing the four delegate methods: (void)controllerWillChangeContent:(NSFetchedResultsController *)controller (void)controller:(NSFetchedResultsController *)controller didChangeSection:(id )sectionInfo atIndex:(NSUInteger)sectionIndex forChangeType:(NSFetchedResultsChangeType)type (void)controller:(NSFetchedResultsController *)controller didChangeObject:(id)anObject atIndexPath:(NSIndexPath *)indexPath forChangeType:(NSFetchedResultsChangeType)type newIndexPath:(NSIndexPath *)newIndexPath (void)controllerDidChangeContent:(NSFetchedResultsController *)controller rather than implement: (void)controllerDidChangeContent:(NSFetchedResultsController *)controller Any help appreciated // :)

    Read the article

  • Touch draw in Quatz 2D/Core Graphics

    - by OgreSwamp
    Hello, I'm trying to implement "hand draw tool". At the moment algorythm looks like that (I don't insert any code because methods are quite big, will try to explain an idea): Drawing In touchesStarted: method I create NSMutableArray *pointsArray and add point into it. Call setNeedsDisplay: method. In touchesMoved: method I calculate points between last added point from the pointsArray and current point. Add all points to the pointsArray. Call setNeedsDisplay: method. In touchesFinished: event I calculate points between last added point from the array and current point. Set flag touchesWereFinished. Call setNeedsDisplay:. Render: drawRect: method checks is pointsArray != nil and is there any data in it. If there is - it starts to traw circles in each point of this array. If flag touchesWereFinished is set - save current context to the UIImage, release pointsArray, set it to nil and reset the flag. There are a lot disadvantages of this method: It is slow It becomes extremely slow when user touches and move finger for long time. Array becomes enormous "Lines" composed by circles are ugly I would like to change my algorithm to make it bit faster and line smoother. In result I would like to have lines like on the picture at following URL (sorry, not enough reputation to insert an image): http://2.bp.blogspot.com/_r5VzEAUYXJ4/SrOYp8tJCPI/AAAAAAAAAMw/ZwDKXiHlhV0/s320/SketchBook+Mobile(4).png Can you advice me, ho I can draw lines this way (smooth and slim on the edges)? I thought to draw circles with alpha gradient on the edges (to make lines smoother), but it will be extremely slowly IMHO. Thanks for help

    Read the article

  • Core Animation bad access on device

    - by user1595102
    I'm trying to do a frame by frame animation with CAlayers. I'm doing this with this tutorial http://mysterycoconut.com/blog/2011/01/cag1/ but everything works with disable ARC, when I'm try to rewrite code with ARC, it's works on simulator perfectly but on device I got a bad access memory. Layer Class interface #import <Foundation/Foundation.h> #import <QuartzCore/QuartzCore.h> @interface MCSpriteLayer : CALayer { unsigned int sampleIndex; } // SampleIndex needs to be > 0 @property (readwrite, nonatomic) unsigned int sampleIndex; // For use with sample rects set by the delegate + (id)layerWithImage:(CGImageRef)img; - (id)initWithImage:(CGImageRef)img; // If all samples are the same size + (id)layerWithImage:(CGImageRef)img sampleSize:(CGSize)size; - (id)initWithImage:(CGImageRef)img sampleSize:(CGSize)size; // Use this method instead of sprite.sampleIndex to obtain the index currently displayed on screen - (unsigned int)currentSampleIndex; @end Layer Class implementation @implementation MCSpriteLayer @synthesize sampleIndex; - (id)initWithImage:(CGImageRef)img; { self = [super init]; if (self != nil) { self.contents = (__bridge id)img; sampleIndex = 1; } return self; } + (id)layerWithImage:(CGImageRef)img; { MCSpriteLayer *layer = [(MCSpriteLayer*)[self alloc] initWithImage:img]; return layer ; } - (id)initWithImage:(CGImageRef)img sampleSize:(CGSize)size; { self = [self initWithImage:img]; if (self != nil) { CGSize sampleSizeNormalized = CGSizeMake(size.width/CGImageGetWidth(img), size.height/CGImageGetHeight(img)); self.bounds = CGRectMake( 0, 0, size.width, size.height ); self.contentsRect = CGRectMake( 0, 0, sampleSizeNormalized.width, sampleSizeNormalized.height ); } return self; } + (id)layerWithImage:(CGImageRef)img sampleSize:(CGSize)size; { MCSpriteLayer *layer = [[self alloc] initWithImage:img sampleSize:size]; return layer; } + (BOOL)needsDisplayForKey:(NSString *)key; { return [key isEqualToString:@"sampleIndex"]; } // contentsRect or bounds changes are not animated + (id < CAAction >)defaultActionForKey:(NSString *)aKey; { if ([aKey isEqualToString:@"contentsRect"] || [aKey isEqualToString:@"bounds"]) return (id < CAAction >)[NSNull null]; return [super defaultActionForKey:aKey]; } - (unsigned int)currentSampleIndex; { return ((MCSpriteLayer*)[self presentationLayer]).sampleIndex; } // Implement displayLayer: on the delegate to override how sample rectangles are calculated; remember to use currentSampleIndex, ignore sampleIndex == 0, and set the layer's bounds - (void)display; { if ([self.delegate respondsToSelector:@selector(displayLayer:)]) { [self.delegate displayLayer:self]; return; } unsigned int currentSampleIndex = [self currentSampleIndex]; if (!currentSampleIndex) return; CGSize sampleSize = self.contentsRect.size; self.contentsRect = CGRectMake( ((currentSampleIndex - 1) % (int)(1/sampleSize.width)) * sampleSize.width, ((currentSampleIndex - 1) / (int)(1/sampleSize.width)) * sampleSize.height, sampleSize.width, sampleSize.height ); } @end I create the layer on viewDidAppear and start animate by clicking on button, but after init I got a bad access error -(void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; NSString *path = [[NSBundle mainBundle] pathForResource:@"mama_default.png" ofType:nil]; CGImageRef richterImg = [UIImage imageWithContentsOfFile:path].CGImage; CGSize fixedSize = animacja.frame.size; NSLog(@"wid: %f, heigh: %f", animacja.frame.size.width, animacja.frame.size.height); NSLog(@"%f", animacja.frame.size.width); richter = [MCSpriteLayer layerWithImage:richterImg sampleSize:fixedSize]; animacja.hidden = 1; richter.position = animacja.center; [self.view.layer addSublayer:richter]; } -(IBAction)animacja:(id)sender { if ([richter animationForKey:@"sampleIndex"]) {NSLog(@"jest"); } if (! [richter animationForKey:@"sampleIndex"]) { CABasicAnimation *anim = [CABasicAnimation animationWithKeyPath:@"sampleIndex"]; anim.fromValue = [NSNumber numberWithInt:0]; anim.toValue = [NSNumber numberWithInt:22]; anim.duration = 4; anim.repeatCount = 1; [richter addAnimation:anim forKey:@"sampleIndex"]; } } Have you got any idea how to fix it? Thanks a lot.

    Read the article

  • Multi-property "transactions" in Core Data / NSManagedObject / NSFetchedResultsController?

    - by Martijn Thé
    Hi, Is it possible to set multiple properties of an NSManagedObject and have the NSFetchedResultsController call controllerDidChangeContent: only once? In other words, is it possible to say something like: [managedObject beginChanges]; [managedObject setPropertyA:@"Foo"]; [managedObject setPropertyB:@"Bar"]; [managedObject commitChanges]; and then have the NSFetchedResultsController call controllerDidChangeContent: (and the other methods) only one time? Thanks!

    Read the article

  • Implementing Tagging using Core Data on the iPhone

    - by Jonathan Penn
    I have an application that uses CoreData and I'm trying to figure out the best way to implement tagging and filtering by tag. For my purposes, if I was doing this in raw SQLite I would only need three tables, tags, item_tags and of course my items table. Then filtering would be as simple as joining between the three tables where only items are related to the given tags. Quite straightforward. But, is there a way to do this in CoreData and utilizing NSFetchedResultsController? It doesn't seem that NSPredicate give you the ability to filter through joins. NSPredicate's aren't full SQL anyway so I'm probably barking up the wrong tree there. I'm trying to avoid reimplementing my app using SQLite without CoreData since I'm enjoying the performance CoreData gives me in other areas. Yes, I did consider (and built a test implementation) diving into the raw SQLite that CoreData generates, but that's not future proof and I want to avoid that, too. Has anyone else tried to tackle tagging/filtering with CoreData in a UITableView with NSFetchedResultsController

    Read the article

  • core data saving in textboxes in table view controller

    - by user1489709
    I have created a five column (text boxes) cell (row) in table view controller with an option of add button. When a user clicks on add button, a new row (cell) with five column (text boxe) is added in a table view controller with null values. I want that when user fills the text boxes the data should get saved in database or if he changes any data in previous text boxes also it get saved. this is my save btn coding.. -(void)textFieldDidEndEditing:(UITextField *)textField { row1=textField.tag; NSLog(@"Row is %d",row1); path = [NSIndexPath indexPathForRow:row1 inSection:0]; Input_Details *inputDetailsObject1=[self.fetchedResultsController objectAtIndexPath:path]; /* Update the Input Values from the values in the text fields. */ EditingTableViewCell *cell; cell = (EditingTableViewCell *)[self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:row1 inSection:0]]; inputDetailsObject1.mh_Up= cell.cell_MH_up.text; inputDetailsObject1.mh_down=cell.cell_MH_dn.text; inputDetailsObject1.sewer_No=[NSNumber numberWithInt:[cell.cell_Sewer_No.text intValue]]; inputDetailsObject1.mhup_gl=[NSNumber numberWithFloat:[cell.cell_gl_MHUP.text floatValue]]; inputDetailsObject1.mhdn_gl=[NSNumber numberWithFloat:[cell.cell_gl_MHDN.text floatValue]]; inputDetailsObject1.pop_Ln=[NSNumber numberWithInt:[cell.cell_Line_pop.text intValue]]; inputDetailsObject1.sew_len=[NSNumber numberWithFloat:[cell.cell_Sewer_len.text floatValue]]; [self saveContext]; NSLog(@"Saving the MH_up value %@ is saved in save at index path %d",inputDetailsObject1.mh_Up,row1); [self.tableView reloadData]; }

    Read the article

  • Checking an empty Core Data relationship (SQLite)

    - by rwat
    I have a to-many relationship in my data model, and I'd like to get all the objects that have no corresponding objects in the relationship. For example: Customer - Purchases I want to get all Customers that have 0 Purchases. I've read somewhere that I could use "Purchases[SIZE] = 0", but this gives me an unsupported function expression error, which I think means it doesn't work with a SQLite backing store (which I don't want to switch from, due to some performance constraints). Any ideas?

    Read the article

  • Performing multiple fetches in Core Data within the same view

    - by yesimarobot
    I have my CD store setup and everything is working. Once my initial fetch is performed, I need to perform several fetches based on calculations using the data from my first fetch. The examples provided from Apple are great, and helped me get everything going but I'm struggling with executing successive fetches. Any suggestions, or tutorial links are appreciated. Table View loads data from CD store. When a user taps a row it pushes a detail view The detail view loads details from CD. [THE ABOVE STEPS ARE ALL WORKING] I perform several calculations on the data fetched in the detail view. I need to then perform several other fetches based on the results of my calculations.

    Read the article

  • iPhone - Create non-persistent entities in core data

    - by ncohen
    Hi everyone, I would like to use entity objects but not store them... I read that I could create them like this: myElement = (Element *)[NSEntityDescription insertNewObjectForEntityForName:@"Element" inManagedObjectContext:managedObjectContext]; And right after that remove them: [managedObjectContext deleteObject:myElement]; then I can use my elements: myElement.property1 = @"Hello"; This works pretty well even though I think this is probably not the most optimal way to do it... Then I try to use it in my UITableView... the problem is that the object get released after the initialization. My table becomes empty when I move it! Thanks edit: I've also tried to copy the element ([myElement copy]) but I get an error...

    Read the article

  • iPhone Core Data - Access deep attributes with to many relationships

    - by ncohen
    Hi everyone, Let say I have an entity user which has a one to many relationship with the entity menu which has a one to many relationship with the entity meal which has a many to one relationship with the entity recipe which has a one to many relationship with the entity element. What I would like to do is to select the elements which belong to a particular user (username = myUsername) and particular menu*s* (minDate < menu.date < maxDate). Does anyone have an idea how to get them? Thanks

    Read the article

  • Core-Plot crash only in Release Configuration

    - by denbec
    Hey everyone, I really don't know a solution or even an idea to get around the following failure. It only happens in Release Configuration on the Device - Simulator and Debug Configuration work fine. It also only appears on the second launch. So if I have the phone connected to my mac, build the application and run it, everything works fine. If I then close the app and restart, it crashes. After long search, it seems that the error comes from the following line: x.majorIntervalLength = CPDecimalFromFloat(2.0f); The code before: CPLayerHostingView *chartView = [[CPLayerHostingView alloc] initWithFrame:CGRectMake(0, 0, 320, 160)]; [self addSubview:chartView]; // create an CPXYGraph and host it inside the view CPTheme *theme = [CPTheme themeNamed:kCPPlainWhiteTheme]; CPXYGraph *graph = (CPXYGraph *)[theme newGraph]; chartView.hostedLayer = graph; graph.paddingLeft = 20.0; graph.paddingTop = 10.0; graph.paddingRight = 10.0; graph.paddingBottom = 20.0; CPXYPlotSpace *plotSpace = (CPXYPlotSpace *)graph.defaultPlotSpace; plotSpace.xRange = [CPPlotRange plotRangeWithLocation:CPDecimalFromFloat(0) length:CPDecimalFromFloat(100)]; plotSpace.yRange = [CPPlotRange plotRangeWithLocation:CPDecimalFromFloat(0) length:CPDecimalFromFloat(10)]; CPXYAxisSet *axisSet = (CPXYAxisSet *)graph.axisSet; CPXYAxis *x = axisSet.xAxis; x.majorIntervalLength = CPDecimalFromFloat(2.0f); If I comment the last line, everything works fine (off course the interval length is not correct). I would appreciate any help! Thanks in advance!

    Read the article

  • Custom setter methods in Core-Data

    - by andrewebling
    I need to write a custom setter method for a field (we'll call it foo) in my subclass of NSManagedObject. foo is defined in the data model and Xcode has autogenerated @property and @dynamic fields in the .h and .m files respectively. If I write my setter like this: - (void)setFoo: (NSObject *)inFoo { [super setFoo: inFoo]; [self updateStuff]; } then I get a compiler warning on the call to super. Alternatively, if I do this: - (void)setFoo: (NSObject *)inFoo { [super setValue: inFoo forKey: inFoo]; [self updateStuff]; } then I end up in an infinite loop. So what's the correct approach to write a custom setter for a subclass of NSManagedObject?

    Read the article

  • AS3 Core Lib and Adobe Air update frameowork conflicts

    - by Sny
    Hello i am working on an Adobe air html/ajax application in which in need as3Core lib and Air update framework. Update framework work only if I remove as3Corelib from my code. But they both are essential for my project. Btw i am using only JpegEncoder from as3Core lib. Thanks For reading :)

    Read the article

  • Core Data Predicates with Subclassed NSManagedObjects

    - by coneybeare
    I have an AUDIO class. This audio has a SOUND_A subclass and a SOUND_B subclass. This is all done correctly and is working fine. I have another model, lets call it PLAYLIST_JOIN, and this can contain (in the real world) SOUND_A's and SOUND_B's, so we give it a relationship of AUDIO and PLAYLIST. This all works in the app. The problem I am having now is querying the PLAYLIST_JOIN table with an NSPredicate. What I want to do is find an exact PLAYLIST_JOIN item by giving it 2 keys in the predicate sound_a._sound_a_id = %@ && playlist.playlist_id = %@ and sound_b.sound_b_id = %@ && playlist.playlist_id = %@ The main problem is that because the table does not store sound_a and sound_b, but stored audio, I cannot use this syntax. I do not have the option of reorganizing the sound_a and sound_b to use the same _id attribute name, so how do I do this? Can I pass a method to the predicate? something like this: [audio getID] = %@ && playlist_id = %@

    Read the article

  • how to build and run core apps of ics like settings, camera etc on windows

    - by user1495186
    I have downloaded ics 4.0.3 source code, want to modify native settings, what i have to do is 1) add custom modifications to the settings 2) recompile native settings with added modifications 3) build the source code 4) generate a customized build to work on all android devices. How can I achieve the above thing? Every suggestion is appreciated. Thanks in advance. FYI: Using win7,4gb ram, intel i5 processor. Installed cygwin,git.

    Read the article

  • iPhone - Create not persistant entities in core data

    - by ncohen
    Hi everyone, I would like to use entity objects but not store them... I read that I could create them like this: myElement = (Element *)[NSEntityDescription insertNewObjectForEntityForName:@"Element" inManagedObjectContext:managedObjectContext]; And right after that remove them: [managedObjectContext deleteObject:myElement]; then I can use my elements: myElement.property1 = @"Hello"; This works pretty well even though I think this is probably not the most optimal way to do it... Then I try to use it in my UITableView... the problem is that the object get released after the initialization. My table becomes empty when I move it! Thanks

    Read the article

  • Implement delegates for Core Data or not

    - by Spanky
    What advantage is there to implementing the four delegate methods: (void)controllerWillChangeContent:(NSFetchedResultsController *)controller (void)controller:(NSFetchedResultsController *)controller didChangeSection:(id )sectionInfo atIndex:(NSUInteger)sectionIndex forChangeType:(NSFetchedResultsChangeType)type (void)controller:(NSFetchedResultsController *)controller didChangeObject:(id)anObject atIndexPath:(NSIndexPath *)indexPath forChangeType:(NSFetchedResultsChangeType)type newIndexPath:(NSIndexPath *)newIndexPath (void)controllerDidChangeContent:(NSFetchedResultsController *)controller rather than implement: (void)controllerDidChangeContent:(NSFetchedResultsController *)controller Any help appreciated // :)

    Read the article

  • Core Data - insertNewObjectForEntityForName debug

    - by Snow Crash
    I'm trying to figure out why insertNewObjectForEntityForName is not working. I assume it's something to do with my data model but can't be sure. Xcode does not report any errors nor does it crash. All I get is the first log statement output to the console. NSLog(@"Get here..."); Task *task = (Task *)[NSEntityDescription insertNewObjectForEntityForName:@"Task" inManagedObjectContext:insertionContext]; NSLog(@"but never get here..."); Any suggestions as to how I can work out what the problem is?

    Read the article

  • Core Data not-reverse relationship subquery

    - by user561485
    Hi, I have the following entities in CoreData: Village - villageID Bookmark - (relation) village There are multiple villages with each an unique villageID. I have a entity Bookmark which only has a relation to a Village entity; it isn't possible to make a reverse relation. Now I would like to get the village entities where there exists a Bookmark relation. I've red something about subqueries, but I can't get it right for this situation. It must be something like: Village.villageID IN (Bookmark.village.villageID) It isn't possible to get first all the Bookmarks and then loop to get all the Villages, because of the design of the framework. Can this be done in CoreData (I presume the answer is "Yes, of course!") and how?

    Read the article

  • AND NSPedicate on Core Data relationships

    - by jesse001
    I'm having trouble compounding NSPredicate with AND, although using OR works fine. Imagine 2 entities, Doctor and Patient. Doctors can have many patients and patients many doctors. I want to find doctors that, say, have both person1 and person2 as patients. I expected this to work but it returns none. NSPredicate *predicate = [NSPredicate predicateWithFormat:@"ANY patients matches 'person1&&person2'"]; If I change && to ||, I get all doctors that have person1 or person2 as I'd expect. Thanks in advance for your help.

    Read the article

< Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >