Archive

Posts Tagged ‘documentation’

Retain your IB objects in Cocoa Touch

I previously published 2 articles on the fact that you had to retain your objects instantied from Interface Builder. I finally discovered the scientific explanation within an AdMob source file:

Note that top level objects in nibs other than MainWindow.xib in Cocoa Touch are autoreleased, not retained like in OS X. Be sure to use [self retain] in -awakeFromNib when part of a custom nib (as in this example).

Extract from the AdMob SDK source files for iOS.

iPhone’s (simulator) 2.2.1 firmware available fonts

This may be useful to some developers, so I provide it here. This is a list of font families names (bold) and corresponding font names (plain) available on iPhone OS 2.2.1 (in SDK simulator at least).

Read more…

Categories: Cocoa, iPhone SDK Tags: , ,

Following the track of correctly managing CoreData-document loading

Since I’m debugging my project at this time, I am investigating deeper on the subject I previously wrote on (see this previous post: How to determine when CoreData’s data is loaded?). It did not take me much time to find something in Apple’s documentation (even if I never fell on it before):

Cannot access contents of an object controller after a nib is loaded

Problem: You want to perform an operation with the contents of an object controller (an instance of NSObjectController, NSArrayController, or NSTreeController) after a nib file has been loaded, but the controller’s content is nil.

Cause: The controller’s fetch is executed as a delayed operation performed after its managed object context is set (by nib loading)—the fetch therefore happens after awakeFromNib and windowControllerDidLoadNib:.

Remedy: You can execute the fetch “manually” with fetchWithRequest:merge:error:—see “Core Data and Cocoa Bindings.”

You can find this extract in the “Core Data Programming Guide”, “Troubleshooting Core Data” section (in Apple’s Mac OS X Developer documentation). It may be in previous versions of the documentation, but I currently use Leopard’s.

If I understand well Apple’s remedy, I should not try to wait my data to be loaded (and therefore find a way to know it), I should rather force the loading myself. So why not? I’ll try, and let you know if it works (and is fine) for me…

Follow

Get every new post delivered to your Inbox.