Basically, I'm finding numerous places where I call SendXtMessage within a function only to have to drop out to wait for the onExtensionResponse to get called. After this I then need to pick up where I left off within the previous function and all of this is starting to get messy.
I could write my own generic callback system to deal with this but wondered whether anyone has considered/tried putting some of the iPhone API calls (in particular onExtensionResponse) into a separate thread so that after sendXtMessage is called I can simply sit in a loop with the busy icon until the response comes through (or is this a bad way of dealing with iPhone dev?).
Ta,
Moo.
Placing onExtensionResponse into a thread
I could write my own generic callback system to deal with this but wondered whether anyone has considered/tried putting some of the iPhone API calls (in particular onExtensionResponse) into a separate thread so that after sendXtMessage is called I can simply sit in a loop with the busy icon until the response comes through (or is this a bad way of dealing with iPhone dev?).
In general I don't think it's a great idea. I am no iPhone expert but in general running thread is an expensive operation and I would expect it to be even more expensive on portable devices.
Since the time between a request in its response can be a few hundreds millisecond you might end up creating Threads for just a fraction of a second.
Your second idea seems to be best one.
Just my 2c
Return to “iPhone Objective-C API”
Who is online
Users browsing this forum: No registered users and 18 guests