1

I have a requirement that when application install on device then it will never show any screen and start a thread in background for 30 seconds. When complete that time then it will show a screen in application.

I mean to say that when we install an application on device then it show a Black Screen for a moment and read

applicationDidFinishLaunching

after that it will don't show any screen. And in background we have start a thread for 30 seconds when that time period will complete then it will show a new view.

How do that? what is proper way to do that?

Thanks in advance

Parth Bhatt
  • 19,381
  • 28
  • 133
  • 216
ios
  • 552
  • 5
  • 22
  • you question is some confusing. basically what do you want? 1) do you not want to that black screen or 2) you want to show a blank screen every time like a splash screen? – hchouhan02 Mar 13 '12 at 06:08

2 Answers2

0

When your app installs on device as per my understanding there is no way your app can start a background thread. You app is not active in the first place.

Once your app is invoked by the user, then you can start a background thread & do what needs to be done. Best way to start background threads in iOS is blocks -

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
    //do background task
    dispatch_async(dispatch_get_main_queue(), ^{
        // update UI after task is done.
    });
});

This block based threading is perfect as GCD takes care of evenly distributing your task in case of multi-core processors, queuing tasks, memory handling of threads etc. all of this is handled for you.

Srikar Appalaraju
  • 71,928
  • 54
  • 216
  • 264
0

It sounds like some sort of daemon. If yes, it is not possible.

anticyclope
  • 1,577
  • 1
  • 10
  • 26