//启动基本完成程序准备开始运行.
- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {
returnYES;
}
//当应用程序将要进入非活动状态.在此期间,应用程序不接收消息或事件,比如来电话了.
- (void)applicationWillResignActive:(UIApplication*)application {}
//当程序被推送到后台的时候调用。所以要设置后台继续运行,则在这个函数里面设置即可.
- (void)applicationDidEnterBackground:(UIApplication*)application {}
//当程序从后台将要重新回到前台时候调用.
- (void)applicationWillEnterForeground:(UIApplication*)application {}
//当应用程序入活动状态执行.
- (void)applicationDidBecomeActive:(UIApplication*)application {}
//当程序将要退出是被调用,通常是用来保存数据和一些退出前的清理工作。这个需要要设置UIApplicationExitsOnSuspend的键值。
- (void)applicationWillTerminate:(UIApplication*)application {}
//请求委托打开一个 URL资源
- (BOOL)application:(UIApplication*) application handleOpenURL:(NSURL*)url{}
//请求委托打开一个 URL资源
- (BOOL)application:(UIApplication*) application openURL:(NSURL*)url sourceApplication:(NSString*)sourceApplication annotation:(id)annotation{}
//当内存低告警时
- (void)applicationDidReceiveMemoryWarning:(UIApplication*)application{}
//当系统时间发生显著改变时
-(void)applicationSignificantTimeChange:(UIApplication*)application{}
//当一个运行着的应用程序收到一个远程的通知 发送到委托去...7.0之前
- (void)application:(UIApplication*)application didReceiveRemoteNotification:(NSDictionary*)userInfo{}
//当一个运行着的应用程序收到一个远程的通知 发送到委托去...7.0之后
- (void)application:(UIApplication*)application didReceiveRemoteNotification:(NSDictionary*)userInfo fetchCompletionHandler:(void(^)(UIBackgroundFetchResult))completionHandler{}
//当一个应用程序成功的注册一个推送服务(APS) 发送到委托去...
-(void)application :(UIApplication*) application
didRegisterForRemoteNotificationsWithDeviceToken:(NSData*) deviceToken{}
//当 APS无法成功的完成向 程序进程推送时 发送到委托去..
-(void)application :(UIApplication*) application
didFailToRegisterForRemoteNotificationsWithError:(NSError*) error{}
//当一个运行着的应用程序收到一个本地的通知 发送到委托去...
-(void)application :(UIApplication*) application didReceiveLocalNotification:(UILocalNotification*)notification{}
1.设置icon上的数字图标
//设置主界面icon上的数字图标,在2.0中引进, 缺省为0
[UIApplicationsharedApplication].applicationIconBadgeNumber= 4;
//摇动手势,是否支持redo undo操作。
//3.0以后引进,缺省YES
[UIApplicationsharedApplication].applicationSupportsShakeToEdit=YES;
//判断程序运行状态,在2.0以后引入
if([UIApplicationsharedApplication].applicationState==UIApplicationStateInactive){
NSLog(@"程序在运行状态");
}
//阻止屏幕变暗,慎重使用,缺省为no 2.0
[UIApplicationsharedApplication].idleTimerDisabled=YES;
慎重使用本功能,因为非常耗电。
//显示联网标记 2.0
[UIApplicationsharedApplication].networkActivityIndicatorVisible=YES;
NSString* addressText =@"1 Infinite Loop, Cupertino, CA 95014";
// URL encode the spaces
addressText = [addressTextstringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
NSString* urlText = [NSStringstringWithFormat:@"http://maps.google.com/maps?q=%@", addressText];
[[UIApplicationsharedApplication]openURL:[NSURLURLWithString:urlText]];
NSString*recipients =@"mailto:first@example.com?cc=second@example.com,third@example.com&subject=Hello from California!";
NSString*body =@"&body=It is raining in sunny California!";
NSString*email = [NSStringstringWithFormat:@"%@%@", recipients, body];
email = [emailstringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[[UIApplicationsharedApplication]openURL:[NSURLURLWithString:email]];
// Call Google 411
[[UIApplicationsharedApplication]openURL:[NSURLURLWithString:@"tel://8004664411"]];
// Text to Google SMS
[[UIApplicationsharedApplication]openURL:[NSURLURLWithString:@"sms://466453"]];
// Lanuch any iPhone developers fav site
[[UIApplicationsharedApplication]openURL:[NSURLURLWithString:@"http://itunesconnect.apple.com"]];