This is a two part question.
- I have created a user agreement that the user must agree to when first launching the app (it is an alert with some information and agree/ do not agree button)
I call upon the method that creates this alert inside myAppDelegate.m and within the method
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
The problem is the alert pops up when the splash screen has finished loading and my first view comes up. I want this to happen during the splash screen. How would I do this?
The second question is When the users presses the “Do not agree button”, I want them to exit the app so I have programmed it with
exit(0);
Is there a better way and will apple reject my app because of this?
Thanks in advance
1) You can’t — during the splash screen (your default.png) the app is loading into memory, and it cannot therefore execute any code, including presentation of a UIAlertView. That’s why you don’t see the alert until the splash disappears — removal of the splash screen is the last thing that the app does before calling
applicationDidFinishLoading:withOptions:.What you can do is create a view controller that mimics your splash screen. This is easy — you can even reuse
default.pngas a background if you want, though a better idea is just to present in this first view controller your agreement text and agree/disagree buttons.As to your question re: use of
exit(), it’s best to avoid doing that. If the user refuses, you can simply do nothing. Of course, if you go the view controller route as I suggest, you can leave presented another opportunity for the user to agree.Another thought is that Apple allows you to customize the EULA of your app when you upload a binary — you could put it there and be covered.