Tag Archives: multitasking

A few iOS gotchas: NSDate copy, sleep and multitask

I was working on a new app and this app has something to do with timing. Basically I need to record the time between a button being displayed and the time a user touches the button (note they are in two different functions).

NSDate and memory leak
To accomplish this, I am using NSDate class, I declared NSDate * start in the class,
and then in one function, I was doing
start = [NSDate date];

and in the second function, I was doing
NSDate *methodFinish = [NSDate date];
NSTimeInterval intervalTime = [methodFinish timeIntervalSinceDate:start];

But the code above crashes immediately. After some research I believe this has something to do with memory, if we copy (retain) the NSDate as suggested by this thread in iphonedevsdk.com. It worked.

NSDate* now = [NSDate date]; // unretained
start = [now copy]; // retained


Continue reading

Does multitasking work (I)?

One big complaints on the new iPad is its lack of multitasking support. From technical perspective, I think that’s because iPad will be use iPhone OS, currently at 3.2 beta, and it does not support multitasking. It does support iPod (listening to music) and another task such as browsing web though. Some developers speculate Apple will support multitask in its iPhone OS 4.0.

Oh well, my point here is not just about iPhone/iPad multitasking. My point is trying to discuss whether multitasking, work both for us human beings and for the computers (ultimately controlled by us and supposed to help us work more efficiently). To be honest I don’t have the answer. But I read one interesting article when I google “multitasking makes you stupid”. I did not intensionally typed in those words, it just stands out when I typed “multitasking” in my browser google toolbar (another one is multitasking myth). Anyway, here are an interesting article from the Atlantic (2007)

The Autumn of the Multitaskers
and here an review article on the Atlantic article.
Multitasking Makes You Slow and Stupid…(I would read this one after the Long Atlantic article).

Continue reading