(iOS) Corona Delegates methods not being called

Hello everyone,

I am trying to use the willFinishLaunchingWithOptions delegate method but it is never being called. The other methods, didFinishLaunching… willLoadMain and didLoadMain are all being called normally.

I checked the CoronaDelegate interface and it does extends, and so should have access, the UIApplicationDelegate. I am using buld number 2014.2329. Am I am missing something here ?

I tested this again using Corona version 2417 and this delegate is still not being called. Is there something else that I need to do to access this delegate or is it really not being called from Corona ? If this is the case, can you expose this delegate for us ?

I need to access some of the launch args being used before the lua runtime is loaded so that I can load my native modules using the correct parameters being passed during the boot up of the application. This modules are accessed from lua, and with the current delegates available I can only change this parameters after everything (including my lua modules) has finished loading.

Ah this is a bug. Looks like the CoronaDelegate instance is not instantiated until the didFinishLaunchingWithOptions delegate method is called, and that happens after willFinishLaunchingWithOptions is called. As a result both  ‘application:willFinishLaunchingWithOptions:’ and ‘application:supportedInterfaceOrientationsForWindow:’ were not getting called.

Both of these issues will be fixed in daily build 2420 or after. 

BTW, what values from the launch options NSDictionary do you need to make available to your Lua modules?

Thanks for the follow up Walter!

We are doing some tests with remote configurations of games. We are using the URL from the launch args to download the proper configuration from the server. Getting this information on this delegate is easier (with least impact on existing code) way for us to load this information before the app really starts.

I tested this again using Corona version 2417 and this delegate is still not being called. Is there something else that I need to do to access this delegate or is it really not being called from Corona ? If this is the case, can you expose this delegate for us ?

I need to access some of the launch args being used before the lua runtime is loaded so that I can load my native modules using the correct parameters being passed during the boot up of the application. This modules are accessed from lua, and with the current delegates available I can only change this parameters after everything (including my lua modules) has finished loading.

Ah this is a bug. Looks like the CoronaDelegate instance is not instantiated until the didFinishLaunchingWithOptions delegate method is called, and that happens after willFinishLaunchingWithOptions is called. As a result both  ‘application:willFinishLaunchingWithOptions:’ and ‘application:supportedInterfaceOrientationsForWindow:’ were not getting called.

Both of these issues will be fixed in daily build 2420 or after. 

BTW, what values from the launch options NSDictionary do you need to make available to your Lua modules?

Thanks for the follow up Walter!

We are doing some tests with remote configurations of games. We are using the URL from the launch args to download the proper configuration from the server. Getting this information on this delegate is easier (with least impact on existing code) way for us to load this information before the app really starts.

I’m using build 2015.2541 and I’m still experiencing the delegate functions not being called.

For me it’s the didFinishLaunchingWithOptions and applicationDidBecomeActive functions which are not being called, but didLoadMain and willLoadMain are both being called.

Given that is was fixed in build 2420, is there something else that I need to do in my code to make these be triggered?

I just tried it and I’m not able to reproduce. You should submit a bug with an Xcode project that can reproduce your issue if you still think this is a Corona issue.

I’m not saying for sure that it is a Corona issue, perhaps there is something that needs to be done in an Xcode-Corona project to make these functions happen, but I’m not an experienced Xcode dev so I’m not sure. 

Is there anything that you can think of that would stop those functions from occuring? A setting or other function call perhaps?

In that case, try getting this method to work in a standard xcode project first. Then copy that method over to your Corona project.

Just occurs to me, two assumptions you can check: are u using the latest daily build, and are other delegate methods working (if so, that would imply you have a typo in the declaration of the delegate methods that aren’t working)

Not using the very latest (we need to submit tomorrow and the local/push notifications moving to plugins is extra work which we could do without right now), but as mentioned in my first post we’re using build 2015.2541.

As for the delegates methods, didLoadMain and willLoadMain both work. The didFinishLaunchingWithOptions function doesn’t have much in it, but there is a NSLog call which doesn’t get called. I don’t think there is a typo in there, but I could be wrong.

- (BOOL)application:(UIApplication \*)application didFinishLaunchingWithOptions:(NSDictionary \*)launchOptions { NSLog(@"didFinishLaunchingWithOptions"); [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:NO]; return YES; }

I don’t think I’ve actually made any changes to the didFinishLaunchingWithOptions signature from the template provided with Corona Enterprise.

 

I’m using build 2015.2541 and I’m still experiencing the delegate functions not being called.

For me it’s the didFinishLaunchingWithOptions and applicationDidBecomeActive functions which are not being called, but didLoadMain and willLoadMain are both being called.

Given that is was fixed in build 2420, is there something else that I need to do in my code to make these be triggered?

I just tried it and I’m not able to reproduce. You should submit a bug with an Xcode project that can reproduce your issue if you still think this is a Corona issue.

I’m not saying for sure that it is a Corona issue, perhaps there is something that needs to be done in an Xcode-Corona project to make these functions happen, but I’m not an experienced Xcode dev so I’m not sure. 

Is there anything that you can think of that would stop those functions from occuring? A setting or other function call perhaps?

In that case, try getting this method to work in a standard xcode project first. Then copy that method over to your Corona project.

Just occurs to me, two assumptions you can check: are u using the latest daily build, and are other delegate methods working (if so, that would imply you have a typo in the declaration of the delegate methods that aren’t working)

Not using the very latest (we need to submit tomorrow and the local/push notifications moving to plugins is extra work which we could do without right now), but as mentioned in my first post we’re using build 2015.2541.

As for the delegates methods, didLoadMain and willLoadMain both work. The didFinishLaunchingWithOptions function doesn’t have much in it, but there is a NSLog call which doesn’t get called. I don’t think there is a typo in there, but I could be wrong.

- (BOOL)application:(UIApplication \*)application didFinishLaunchingWithOptions:(NSDictionary \*)launchOptions { NSLog(@"didFinishLaunchingWithOptions"); [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:NO]; return YES; }

I don’t think I’ve actually made any changes to the didFinishLaunchingWithOptions signature from the template provided with Corona Enterprise.