-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (nsdictionary *) launchOptions
Description: When the application starts, the application launches the portal. Executes only once when the application starts. The application parameter is used to obtain the state, variable, etc. of the application, and it is worth noting the dictionary parameter: (nsdictionary *) launchoptions, which stores the reason for the program to start.
1. If the user starts directly, no data is in the lauchoptions;
2. If the other application through OpenURL: Start, then the Uiapplicationlaunchoptionsurlkey corresponding object is the boot URL (nsurl), Uiapplicationlaunchoptionssourceapplicationkey the bundle ID of the source application that corresponds to the startup (NSString);
3. If initiated by local notification, the Uiapplicationlaunchoptionslocalnotificationkey corresponds to the local notification object (uilocalnotification) for the launch application;
4. If initiated by remote notification, the Uiapplicationlaunchoptionsremotenotificationkey corresponds to the remote notification information userinfo (nsdictionary) that initiates the application;
Other keys also have Uiapplicationlaunchoptionsannotationkey,uiapplicationlaunchoptionslocationkey,
Uiapplicationlaunchoptionsnewsstanddownloadskey. If you want to make some distinctions at startup, you need to do this in the code below. For example, an app can be picked up by some other app (as a sub-app for that app), and to achieve a single sign-on, you need to make reasonable authentication in the boot code and skip the login.
-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (nsdictionary *) launchOptions
{
Nsurl *url = [Options Objectforkey:uiapplicationlaunchoptionsurlkey];
if (URL)
{
}
NSString *bundleid = [Options Objectforkey:uiapplicationlaunchoptionssourceapplicationkey];
if (Bundleid)
{
}
Uilocalnotification * localnotify = [options Objectforkey:uiapplicationlaunchoptionslocalnotificationkey];
if (localnotify)
{
}
Nsdictionary * userInfo = [options Objectforkey:uiapplicationlaunchoptionsremotenotificationkey];
if (userInfo)
{
}
}
According to the current program status, determine whether the current program is pushed (foreground does not push, background push)
-(void) Application: (UIApplication *) application didreceiveremotenotification: (nsdictionary *) userInfo{
[Umessage Didreceiveremotenotification:userinfo];
Customizing the Popup Box
if ([uiapplication sharedapplication].applicationstate = = uiapplicationstateactive) {//program is active, push not allowed
[Umessage setautoalert:no];//close the Prompt box
}else{//Allow push
[Umessage Didreceiveremotenotification:userinfo];
Send Notifications
Nsnotificationcenter *center = [Nsnotificationcenter defaultcenter];
Send remote Notifications
[Center postnotificationname:@ "Cyremotenotication" Object:nil Userinfo:userinfo];
}
}
IOS Launcher 4 ways, as well as allies push in the foreground without pushing, and the status of the current program