I'm building a Xamarin iOS app which uses Ninject (a DI framework). I'm wondering where do I put the code that loads the modules and does the initialization of my application classes?
Main.cs class?What's the best practice? I can't seem to find it on google.
Due to the fact the UIApplication runloop is created/initialized during the UIApplication construction, I would avoid using the Main entry point as global app initiation point as the app's runloop is not available. Calling any iOS framework members during this phase can led to strange app behavior, crashes, file corruption, etc..
Also any initialization code that hangs (delays) the app at this point will cause the OS to kill your process and any external crash reporting will not happen. Apple's crash reports will be very generic SIGABRT reports.
The UIApplicationDelegate is also created during the UIApplication construction and the FinishedLaunching (application:didFinishLaunchingWithOptions:) delegate method is messaged after the UIApplication, its runloop and UIApplicationDelegate are constructed, but before the UIWindow and root VC are, thus making it the preferred delegate override.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With