You can build a variety of amazing apps on the iOS platform—and every one of them presents a unique set of problems. With the recipes in this cookbook, you'll go beyond theory to solve the vexing, real-life issues you’re likely to face when creating apps for the iPhone, iPad, or …
Chock full of code.
Pros: Helpful examples
Best Uses: Intermediate, Expert
Describe Yourself: Developer, Educator
Disclosure: I’m an O’Reilly Author and developer of the Great iPhone Development Video series. That being said, I’m not one for pulling punches when I see issues with with people’s code (ask anyone I’ve ever code reviewed .
This is the book I wish I’d had when I started developing for the iPhone. I started writing apps about two weeks after the infamous Apple Developer NDA was lifted and information started trickling out onto the Internet. If I’d have had a book like the iOS Cookbook I could have saved myself many hours of painful trial and error while learning Objective C and what is now the iOS API.
This is not really a book for a beginning iOS programmer. It’s a book for someone who’s done a couple of simple apps and has the basic idiom down. If you’re looking to learn Objective-C or the mechanics of writing an iPhone app, this book will not help you. But if you can already write a functional app, the code snippets in this book will trim lots of time off of your learning curve when it comes to implementing more sophisticated features like Core Data, gestures, etc.
There are a few areas where the examples could be clearer, and it’s clearly impossible to cover some of the more sophisticated functions of areas like Core Data in 620 pages. But overall this is an excellent REFERENCE for new and experienced app developers alike, and I’d recommend adding it to your library.
In general, I like the NSUndoManager functionality in iOS, but sometimes the secret handshakes you need to know can really get me down. For example, I needed to disable undo/redo when setting a particular property of a model entity. Reading the documentation, this seemed pretty straightforward:
[[theApp.managedObjectContext undoManager] disableUndoRegistration]; detailItem.fieldImageFile = relativePath; [[theApp.managedObjectContext undoManager] enableUndoRegistration];
Seemed very clear, but it didn’t work! So, after much poking around on the Internet, I found a posting that alluded to the fact that changes to undo don’t occur until the run loop executes. So, to get the desired effect, I ended up with the following code:
[[NSRunLoop currentRunLoop] runMode: NSDefaultRunLoopMode beforeDate:[NSDate date]]; [[theApp.managedObjectContext undoManager] disableUndoRegistration]; detailItem.fieldImageFile = relativePath; [[NSRunLoop currentRunLoop] runMode: NSDefaultRunLoopMode beforeDate:[NSDate date]]; [[theApp.managedObjectContext undoManager] enableUndoRegistration];
Yet another head-scratching API decision from Apple.