美文网首页
【iOS开发】判断app启动的方式(launchOptions

【iOS开发】判断app启动的方式(launchOptions

作者: 为了你而活 | 来源:发表于2017-06-05 18:32 被阅读142次

(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

// Override point for customization after application launch.

//用户自己点击启动

if(!launchOptions)

{

NSLog(@"用户点击app启动");

}

else

{

NSURL *url = [launchOptions objectForKey:UIApplicationLaunchOptionsURLKey];

//app 通过urlscheme启动

if (url) {

NSLog(@"app 通过urlscheme启动 url = %@",url);

}

UILocalNotification *localNotification = [launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey];

//通过本地通知启动

if(localNotification)

{

NSLog(@"app 通过本地通知启动 localNotification = %@",localNotification);

}

NSDictionary *remoteCotificationDic = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];

//远程通知启动

if(remoteCotificationDic)

{

NSLog(@"app 通过远程推送通知启动 remoteCotificationDic = %@",remoteCotificationDic);

}

}

return YES;

}

相关文章

网友评论

      本文标题: 【iOS开发】判断app启动的方式(launchOptions

      本文链接:https://www.haomeiwen.com/subject/lkfmfxtx.html