objective c - iOS - app interface freezes up on startup during network calls -
the app working on fetches bunch of different newsfeeds when first starts , updates expired ones. while happening interface freezes , can't click anything. actual network calls being done on separate thread, database operations being done on main thread. cause interface freeze?
i have been told need make 2 feeds update inserted network operation queue @ time won't try of them @ once, it's set many network calls @ once. don't understand how having less things in queue @ time cause go faster if they're going put in there sequentially anyways. please correct me if wrong, i'm still pretty new this.
any kind of regarding cause ui freeze during startup appreciated!
it idea move time consuming operation away main thread.
fortunately pretty simple on ios. if time-consuming task simple consider using performselectorinbackground
e.g:
[self performselectorinbackground:@selector(myfunction:) withobject:myparam]; it important remberber, must not access gui background thread. objects main thread use performselectoronmainthread
e.g:
[self performselectoronmainthread:@selector(myfunction:) myparamwaituntildone:yes]; try applying strategy database calls. depending on scenario might want wrap in nsoperation or use thread when cause of freeze found.
Comments
Post a Comment