1

I have to create an application where I'm very limited to modify things. This is an Agentry application provided by SAP, that is kind of a render for a proprietary metadata programming language (like Apache Cordova but not for HTML unfortunately).

SAP delivers a framework and allows me to do some small changes to create a custom app with my own icons and data. My main goal is to add a database to this app so the user has all the data ready after installing.

The problem is that this is increasing the launch time a lot and the app crashes for older iPads with less processing power do to reaching the limit of 20 seconds.

Since this is an enterprise app that is not going to be published in the iOS AppStore, I was wondering if I could increase this timeout somehow.

And idea of what could I do?

Edit: Sorry, I'm not an iOS developer and I was not sure about my limitations. I found out that my "main.m" has only one instruction that is:

return UIApplicationMain(argc, argv,@"SMPAgentryApplication", @"SMPAgentryClientAppDelegate");

then all the AppDelegate and ViewController classes are empty because everything is done in the encapsulated framework. Given that I think I can't implement any of the given solutions.

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
RaTiO
  • 979
  • 2
  • 17
  • 33
  • instead of loading the data in the `applicationDidFinishLaunchingWithOptions` method (I guess you are doing this) create a *Splash* controller that will be loaded from there and do all the initial set up in the controller. This may not be the best solution (I prefer to load the data in a background thread) but it is the easiest to implement, and can be a *good fit* for an Enterprise App. – tkanzakic Feb 29 '16 at 15:51

3 Answers3

1

The launch ends when you return from didFinishLaunchingWithOptions:

Change your code so that didFinishLaunchingWithOptions: starts everything you need in the background and then returns.

gnasher729
  • 51,477
  • 5
  • 75
  • 98
-1

Move initialisation code inside viewDidAppear instead of viewDidLoad. This way you won't have to worry about launch time.

hris.to
  • 6,235
  • 3
  • 46
  • 55
  • This won't help. The startup time limit is specific to the code that runs in `didFinishLaunchingWithOptions:`, see the other answer. – Kerni Feb 29 '16 at 16:01
  • You are probably right. However if you instantiate VC in `didFinishLaunchingWithOptions` which has some heavy code inside `viewDidLoad`, you will experience the exact same problem. Anyway @gnasher729 answer seems better than mine. – hris.to Feb 29 '16 at 16:22
-1

Simply add the sleep timer in didFinishLaunchingWithOptions:

[NSThread sleepForTimeInterval:5.0];

This will stop the further processing in the mean time you can either display the launchscreen for the seconds which you had added in the timer or can perform some other tasks that you want. Hope this helps :)

Pratik Shah
  • 563
  • 4
  • 14
  • The app gets killed / crashes because it takes too much time - how is adding a further time penalty going to help in any way? – luk2302 Feb 29 '16 at 16:37