0

I want to download the data from server before launch

I know there is a way to duplicate the launch view and load it till the success callback from service came

But i need to know whether there is another UIapplicationprotocol method which can be called before didfinsishlaunch to achieve this.Can anybody guide me on this?

hacker
  • 8,919
  • 12
  • 62
  • 108

4 Answers4

0

No. As discussed in this question, Apple requires that your application launch time be relatively short, or your app will be killed. So it's not a good idea to synchronously connect to the network before/during applicationDidFinishLaunching.

Instead, you can start an asynchronous task (see NSURLSession) and show a progress indicator/spinner while it is executing.

Community
  • 1
  • 1
jtbandes
  • 115,675
  • 35
  • 233
  • 266
0
- (BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:(nullable NSDictionary *)launchOptions 

above method will be called before method 'didfinishLaunching' method.

Payal Maniyar
  • 4,293
  • 3
  • 25
  • 51
0

As far as I know,there is no such an method. but you can try to use BackgroundFetch,it can let you download data even the app is not be launched.

zhubch
  • 194
  • 1
  • 1
  • 8
0

You can use the willFinishLaunchingWithOptions method to solve it. It was shown in https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplicationDelegate_Protocol/index.html?hl=ar