iOS App Launch Option
来源:互联网 发布:淘宝找不到自己的店铺 编辑:程序博客网 时间:2024/05/22 06:39
iOS 程序启动时总会调用application:didFinishLaunchingWithOptions:,其中第二个参数launchOptions为NSDictionary类型的对象,里面存储有此程序启动的原因。
launchOptions中的可能键值见UIApplication Class Reference的Launch Options Keys节 。
- 若用户直接启动,lauchOptions内无数据;
- 若由其他应用程序通过openURL:启动,则UIApplicationLaunchOptionsURLKey对应的对象为启动URL(NSURL);
- 若由其他应用启动,则UIApplicationLaunchOptionsSourceApplicationKey对应启动的源应用程序的bundle ID (NSString);
- 若由本地通知启动,则UIApplicationLaunchOptionsLocalNotificationKey对应的是为启动应用程序的的本地通知对象(UILocalNotification);
- 若由远程通知启动,则UIApplicationLaunchOptionsRemoteNotificationKey对应的是启动应用程序的的远程通知信息userInfo(NSDictionary);
- 其他key还有UIApplicationLaunchOptionsAnnotationKey,UIApplicationLaunchOptionsLocationKey,
UIApplicationLaunchOptionsNewsstandDownloadsKey。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ if (!launchOptions) { NSLog(@"用户直接启动"); [self alertMessage:@"用户直接启动"]; }else{ NSURL *url = [launchOptions objectForKey:UIApplicationLaunchOptionsURLKey]; if(url){ NSLog(@"由其他应用程序通过openURL:%@启动",[url absoluteString]); [self alertMessage:@"由其他应用程序通过openURL"]; } NSString *bundleId = [launchOptions objectForKey:UIApplicationLaunchOptionsSourceApplicationKey]; if(bundleId){ NSLog(@"由其他应用启动,那个应用的bundle ID = %@",bundleId); [self alertMessage:@"由其他应用启动"]; } UILocalNotification * localNotify = [launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey]; if(localNotify){ NSLog(@"由本地通知启动,通知内容为%@",localNotify.alertBody); [self alertMessage:@"由本地通知启动"]; } NSDictionary *userInfo = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey]; if(userInfo){ NSLog(@"由远程通知启动,远程通知的userinfor不为空"); [self alertMessage:@"由远程通知启动"]; } }}
0 0
- iOS App Launch Option
- iOS App Launch Option
- iOS App Launch Option
- iOS App Launch Option
- iOS App Launch Option
- iOS App Launch Option
- iOS App Launch Option
- iOS App Launch Option(附点击推送操作)
- iOS: Failed to launch .app file
- IOS-获取APP的Launch Image
- Ios 获取APP的Launch Image
- iOS - Could not launch"appName" process launch failed: timed out waiting for app to launch:
- iOS - Could not launch"appName" process launch failed: timed out waiting for app to launch
- [IOS开发]app的icon和launch image的尺寸
- ios App Icon 和Launch Images图标规格尺寸
- ios设置app初始化的背景图片Launch Images
- iOS真机调试时“process launch failed: timed out waiting for app to launch”问题
- iOS开发 报错process launch failed: timed out waiting for app to launch的解决方案
- Javascript中常见的校验
- linux的时区名字列表位于目录/usr/share/zoneinfo下。
- 视图动画实现类的分工
- 使用Paint事件重画GroupBox来修改边框颜色
- DedeCms模板 如何防被盗以及安全设置的一些方法
- iOS App Launch Option
- CAP原理与最终一致性
- Linux下NFS(网络文件系统)的安装与配置方法
- iOS 从url中获取文件名以及后缀
- Lizcst Software Lab 正式入驻新华军软件商城——华商团!
- iptables 命令详解
- 远程桌面连接窗口模式最大化分辨率
- 【Google官方教程】前言:高效的Bitmap显示
- Android 双击返回键退出程序 实现