Asynchronous vs Synchronous vs Threading in an iPhone App

后端 未结 8 1382
失恋的感觉
失恋的感觉 2021-01-30 05:28

I\'m in the design stage for an app which will utilize a REST web service and sort of have a dilemma in as far as using asynchronous vs synchronous vs threading. Here\'s the sce

8条回答
  •  隐瞒了意图╮
    2021-01-30 06:04

    Why can't you use an asynchronous request like so:

    - (NSArray *)users {
         if(users == nil && !didLaunchRequestAlready )
            users = do_async_request // Looks good to me
         return users;
     }
    

    Asynchronous is absolutely the only option - the only real question is if you want to start using separate threads, or if you want to just use the asynch calls. Start there and look at managing threads if you really need to.

提交回复
热议问题