[baseten-users] BXDatabaseContext usage

Tuukka Norri tuukka.norri at karppinen.fi
Wed May 20 00:47:47 EEST 2009


Réjean Lamy kirjoitti 19.5.2009 kello 23.54:
> Thanks for your quick answers. Problem effectively seems around how  
> to connect and when.
> I tried with connectAsync instead of connectSync and now I have the  
> auto-fetch working  !
>
> Any advises ?

Well, it depends :)
-connectAsync probably works because your other nib has time to load  
before the connection gets made. Meanwhile, the array controller  
begins to observe connection notifications, and fetches as soon as it  
gets one. I wouldn't count on this behaviour, though.

If it doesn't matter if your application blocks while connecting, you  
can use -connectSync:. If you want to display a progress indicator or  
something like that while connecting, -connectAsync and -connect: are  
better options. Generally, -connectSync: is better suited for command  
line tools.

If all your nibs get loaded before your connection attempt begins, it  
suffices to set your array controllers to fetch on connect. If not,  
you should probably call -fetch: or -fetchWithRequest:merge:error:  
manually instead.

BXDatabaseContext has some delegate methods, which are called when the  
connection gets made. See BXDatabaseContextDelegateProtocol.h for  
details.
-- 
Best regards,
Tuukka Norri
MK&C



More information about the baseten-users mailing list