Search Results

Search found 61 results on 3 pages for 'dontwatchmyprofile'.

Page 1/3 | 1 2 3  | Next Page >

  • Quick way to get an NSDictionary from an XML NSData representation?

    - by dontWatchMyProfile
    I've loaded an XML file as NSData into memory and parse over the elements using NSXMLParser. Although it works, it's a very ugly and hard to maintain code since there are about 150 different elements to parse. I know there are nice third-party solutions, but I want to keep it with the iPhone SDK for purpose of practice and fun. So I thought: Why not convert that XML file into an NSDictionary? Having this, I could use fast enumeration to go over the elements. Or is it just the same amount of ugly code needed to parse and process an XML right away with NSXMLParser? Would I build up an NSDictionary for every found node in the XML and create a huge one, containing the whole structure and data? Or is there an even simpler way?

    Read the article

  • Does it make sense to use a NSFetchedResultsController without an UITableViewController? How are the

    - by dontWatchMyProfile
    I mean... could I also just create a plain old UIViewController and then set up a UITableView myself, plus an NSFetchedResultsController? How much do UITableViewController and NSFetchedResultsController interact with eachother? As far as I see it, UITableViewController is NOT by default already adopting the NSFetchedResultsControllerDelegate protocol. It almost looks like if UITableViewController has been developed without knowing about NSFetchedResultsController. Probably they even did that before developing FRC. Anyways, just a raw guess because the UITableViewController lacks of mentioning FRC at all. So the only thing I see in UITableViewController is that it is already the delegate for a UITableView by adopting the protocol, and it sets up the UITableView instance for me and assigns it internally to it's tableView property. Is that the whole magic of UITableViewController? (note: the nsfetchedresultscontrolle tag is not a typo. SO has a limit for the num of chars...too bad for that missing r, that's why I avoided this tag in my other buch of questions like the plague)

    Read the article

  • What should I do when the managed object context fails to save?

    - by dontWatchMyProfile
    Example: I have an Cat entity with an catAge attribute. In the data modeler, I configured catAge as int with a max of 100. Then I do this: [newManagedObject setValue:[NSNumber numberWithInt:125] forKey:@"catAge"]; // Save the context. NSError *error = nil; if (![context save:&error]) { NSLog(@"Unresolved error %@, %@", error, [error userInfo]); } I'm getting an error in the console, like this: 2010-06-12 11:40:41.947 CatTest[2250:207] Unresolved error Error Domain=NSCocoaErrorDomain Code=1610 UserInfo=0x10164d0 "Operation could not be completed. (Cocoa error 1610.)", { NSLocalizedDescription = "Operation could not be completed. (Cocoa error 1610.)"; NSValidationErrorKey = catAge; NSValidationErrorObject = <NSManagedObject: 0x10099f0> (entity: Cat; id: 0x1006a90 <x-coredata:///Cat/t3BCBC34B-8405-4F16-B591-BE804B6811562> ; data: { catAge = 125; catName = "No Name"; }); NSValidationErrorPredicate = SELF <= 100; NSValidationErrorValue = 125; } Well, so I have an validation error. But the odd thing is, that it seems the MOC is broken after this. If I just tap "add" to add another invalid Cat object and save that, I'm getting this: 2010-06-12 11:45:13.857 CatTest[2250:207] Unresolved error Error Domain=NSCocoaErrorDomain Code=1560 UserInfo=0x1232170 "Operation could not be completed. (Cocoa error 1560.)", { NSDetailedErrors = ( Error Domain=NSCocoaErrorDomain Code=1610 UserInfo=0x1215f00 "Operation could not be completed. (Cocoa error 1610.)", Error Domain=NSCocoaErrorDomain Code=1610 UserInfo=0x1209fc0 "Operation could not be completed. (Cocoa error 1610.)" ); } That seems to report two errors now. BUT: When I try to delete now an valid, existing object from the table view (using the default core data template in a navigation-based app), then the app crashes! All I get in the console is: 2010-06-12 11:47:18.931 CatTest[2250:207] Unresolved error Error Domain=NSCocoaErrorDomain Code=1560 UserInfo=0x123eb30 "Operation could not be completed. (Cocoa error 1560.)", { NSDetailedErrors = ( Error Domain=NSCocoaErrorDomain Code=1610 UserInfo=0x1217010 "Operation could not be completed. (Cocoa error 1610.)", Error Domain=NSCocoaErrorDomain Code=1610 UserInfo=0x123ea80 "Operation could not be completed. (Cocoa error 1610.)" ); } ...so no idea where or why it crashes, but it does. So the question is, what are the neccessary steps to take when there's an validation error?

    Read the article

  • Are there more Cocoa and Cocoa Touch videos which are worth looking at?

    - by dontWatchMyProfile
    To gain a better understanding, I think it would be a good idea to watch every cocoa video available on the net. I tend to find session videos from conferences or good podcast videos only by accident, so maybe someone has a handy list of links to great ressources. I already know all the WWDC stuff and the stuff from stanford, but a lot of universities around the world publish session videos as well in local languages. Also, there are like thousands of conferences around the world with great session videos. This list should compensate for all those who can't afford beeing at WWDC. Therefore, guys, let's create a handy list to fill the gaps for everyone! This is community wiki, so just list them all! I'll start with: English 360 Conferences (360iDev) Videos Oredev with some good iPhone dev session videos German Macoun 2009 with some interesting session videos, if you can speak German Please don't hesitate to post links to videos in other languages than English. Many of us speak more languages, so go ahead! We'll be excited!

    Read the article

  • How to properly deal with KVO notifications when an managed object turns into a fault?

    - by dontWatchMyProfile
    From the docs: When Core Data turns an object into a fault, key-value observing (KVO) change notifications (see Key-Value Observing Programming Guide) are sent for the object’s properties. If you are observing properties of an object that is turned into a fault and the fault is subsequently realized, you receive change notifications for properties whose values have not in fact changed. So if an object turns into a fault, Core Data does send KVO notifications for changed properties? So I must always check for isFault == NO before beeing happy about the notification?

    Read the article

  • How to do an fetch request with expressions like this on the iPhone?

    - by dontWatchMyProfile
    The documentation has an example on how to retrieve simple values only, rather than managed objects. This remembers a lot SQL using aliases and functions to only retrieve calculated values. So, actually pretty geeky stuff. To get the minimum date from a bunch of records, this is used on the mac: NSFetchRequest *request = [[NSFetchRequest alloc] init]; NSEntityDescription *entity = [NSEntityDescription entityForName:@"Event" inManagedObjectContext:context]; [request setEntity:entity]; // Specify that the request should return dictionaries. [request setResultType:NSDictionaryResultType]; // Create an expression for the key path. NSExpression *keyPathExpression = [NSExpression expressionForKeyPath:@"creationDate"]; // Create an expression to represent the minimum value at the key path 'creationDate' NSExpression *minExpression = [NSExpression expressionForFunction:@"min:" arguments:[NSArray arrayWithObject:keyPathExpression]]; // Create an expression description using the minExpression and returning a date. NSExpressionDescription *expressionDescription = [[NSExpressionDescription alloc] init]; // The name is the key that will be used in the dictionary for the return value. [expressionDescription setName:@"minDate"]; [expressionDescription setExpression:minExpression]; [expressionDescription setExpressionResultType:NSDateAttributeType]; // Set the request's properties to fetch just the property represented by the expressions. [request setPropertiesToFetch:[NSArray arrayWithObject:expressionDescription]]; // Execute the fetch. NSError *error; NSArray *objects = [managedObjectContext executeFetchRequest:request error:&error]; if (objects == nil) { // Handle the error. } else { if ([objects count] > 0) { NSLog(@"Minimum date: %@", [[objects objectAtIndex:0] valueForKey:@"minDate"]; } } [expressionDescription release]; [request release]; Nice, I though - but having a deep look into NSExpression -expressionForFunction:arguments: it turns out that iPhone OS does NOT support the min: function. Well, probably there's a nifty way to use an own function for this kind of stuff on the iPhone as well? Because on thing I'm already worrying about is, how I'm gonna sort a table based on the calculated distance of targets on a map (location-based stuff).

    Read the article

  • Does the Fetch Request do the recommended batch faulting?

    - by dontWatchMyProfile
    I'm curious. Apple says in the docs: Core Data automatically fires faults when necessary (when a persistent property of a fault is accessed). However, firing faults individually can be inefficient, and there are better strategies for getting data from the persistent store (see “Batch Faulting and Pre-fetching with the SQLite Store”). NSFetchRequest has this feature: [fetchRequest setFetchBatchSize:20]; Is this essentially performing such a batch faulting like recommended? Just to make this clear for others, faulting does not mean "turning into a fault" but it means "materializing it", just like "making a Scooby-Doo out of it". Pretty ugly wording error, in my opinion, but it's at least consistent in the docs ;)

    Read the article

  • Any chance to get Core Data using Tokyo Cabinet as the persistent store?

    - by dontWatchMyProfile
    I watched a free high quality video with Aaron Hillegass about Core Data vs Tokyo Cabinet. Besides that this guy is amazingly funny (really, if you want to laugh now, watch it!), he shows off Tokyo Cabinet beeing about 40x faster than Core Data. I wonder if it's worth thinking about how to attach this to Core Data? Does that make any sense? Maybe as a custom atomic store or something like this?

    Read the article

  • So does Apple recommend to not use predicates and sort descriptors in an NSFetchRequest?

    - by dontWatchMyProfile
    From the docs: To summarize, though, if you execute a fetch directly, you should typically not add Objective-C-based predicates or sort descriptors to the fetch request. Instead you should apply these to the results of the fetch. If you use an array controller, you may need to subclass NSArrayController so you can have it not pass the sort descriptors to the persistent store and instead do the sorting after your data has been fetched. I don't get it. What's wrong with using them on fetch requests? Isn't it stupid to get back a whole big bunch of managed objects just to pick out a 1% of them in memory, leaving 99% garbage floating around? Isn't it much better to only fetch from the persistent store what you really need, in the order you need it? Probably I did get that wrong...

    Read the article

  • Does the type in this KVC validation method matter?

    - by dontWatchMyProfile
    For example, in the docs a KVC-style validation method is implemented like this: -(BOOL)validateAge:(id *)ioValue error:(NSError **)outError They used id* as the type for ioValue. Since that's not part of the method signature, I wonder if it would hurt to do something like: -(BOOL)validateAge:(NSNumber *)ioValue error:(NSError **)outError Is this still fine with KVC?

    Read the article

  • How to accommodate for the iPhone 4 screen resolution?

    - by dontWatchMyProfile
    This is a programming question! Read on before you vote to close! According to Apple, the iPhone 4 has a new and better screen resolution: 3.5-inch (diagonal) widescreen Multi-Touch display 960-by-640-pixel resolution at 326 ppi This little detail affects our apps in a heavy way. Most of the demo apps on the net have one thing in common: They position views in the believe that the screen has a fixed size of 320 x 480 pixels. So what most -if not all- developers do is: They designed everything in such a way, that a touchable area is -for example- 50 x 50 pixels big. Just enough to tap it. Things have been positioned relative to the upper left, to reach a specific position on screen - let's say the center, or somewhere at the bottom. Edit: It seems Apple has integrated an switch that allows to tell if an app is highRes or not. Nice. When we develop high-resolution apps, they probably won't work on older devices. And if they do, they would suffer a lot from 4-times the size of any image, having to scale them down in memory.

    Read the article

  • Can I use a keyPath in a predicate?

    - by dontWatchMyProfile
    For some reason, this didn't work (although the keypath does exist): NSPredicate *predicate = [NSPredicate predicateWithFormat:@"department.departmentName == %@", departmentName]; [fetchRequest setPredicate:predicate]; NSError *fetchError = nil; NSUInteger count = [moc countForFetchRequest:fetchRequest error:&fetchError]; // execution simply stops at this line, with no error or console log Execution just stops at the last line above when asking for the count. I don't get an console log. Also I don't get any kind of exception. The execution just stops. There are no objects in the persistent store yet. So maybe it crashes because of it tries to follow a keypath in a nonexisting object? Does that make sense? The line where GDB stops is this: 0x002a31cb <+0459> test %eax,%eax Previously to that, I see a lot of NSSQLAdapter... calls in the stack trace. There's definitely something wrong. Well, but when I set the Entity to the destination of the key path and then just do something like NSPredicate *predicate = [NSPredicate predicateWithFormat:@"departmentName == %@", departmentName]; then there is no problem and count simply is 0.

    Read the article

  • What explains the term orthogonal in a more non-nerd fashion?

    - by dontWatchMyProfile
    For example: Cardinality and optionality are orthogonal properties of a relationship. You can specify that a relationship is optional, even if you have specified upper and/or lower bounds. This means that there do not have to be any objects at the destination, but if there are then the number of objects must lie within the bounds specified. What exactly does "orthogonal" mean? I bet it's just a fancy soundig nerd-style word for something that could be expressed a lot easier to understand for average people ;) From wikipedia: In mathematics, two vectors are orthogonal if they are perpendicular, i.e., they form a right angle. The word comes from the Greek ????? (orthos), meaning "straight", and ????a (gonia), meaning "angle". Anyone?

    Read the article

  • Isn't it better to create the subview hierarchy in -viewDidLoad rather than in -loadView?

    - by dontWatchMyProfile
    The docs say that the whole subview hierarchy can be created in -loadView. But there's also this -viewDidLoad method which sounds nice to ovewrite for actually building the hierarchy, when the view loaded. I guess it's a matter of taste only. But maybe doing so in -viewDidLoad hast the advantage that the view controller already adjusted the frame of the view correctly to accomodate for the status bar or any other kind of bar like tab bar or tool bar?

    Read the article

  • Does correcting a value in an validation method mark the object as dirty?

    - by dontWatchMyProfile
    From the docs: If you change the input value in a validate:error: method, you must ensure that you only change the value if it is invalid or uncoerced. The reason is that, since the object and context are now dirtied, Core Data may validate that key again later. If you keep performing a coercion in a validation method, this can therefore produce an infinite loop. So when I modify a value in a validation method, the context gets dirtied? And the next time I save, the validation happens again - and when I change the value even if the validation is OK, then the context is again dirtied, and revalidated again - and I change the value, and Core Data validates, again, because the context is dirtied. And so on...for ever... is that right? Or did they try to say something different?

    Read the article

  • Why doesn't the undo/redo panel appear when I start a shake gesture in iPhone Simulator?

    - by dontWatchMyProfile
    I've created an NSUndoManager for the Managed Object Context of Core Data, like this: NSUndoManager *undoManager = [[NSUndoManager alloc] init]; [undoManager setLevelsOfUndo:10]; [managedObjectContext setUndoManager:undoManager]; [undoManager release]; In the app delegate where the didFinishLaunching method is called, I did this: application.applicationSupportsShakeToEdit = YES; For some reason, I never get that undo/redo panel when I make a shake gesture in iPhone Simulator (from the menu). Must I enable undo/redo somewhere else, maybe in the Info.plist file?

    Read the article

  • When does validation happen in Core Data?

    - by dontWatchMyProfile
    From the docs: If you make changes to managed objects associated with a given context, those changes remain local to that context until you commit the changes by sending the context a save: message. At that point—provided that there are no validation errors—the changes are committed to the store. So does that essentially mean, that validation happens automatically as soon as I call -save?

    Read the article

1 2 3  | Next Page >