我想知道是否有一种方法可以通过单击来启动一个应用程序(可以在后台关闭或打开):
谢谢 !!
最佳答案
把这个代码:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
UILocalNotification *notification = launchOptions[UIApplicationLaunchOptionsLocalNotificationKey];
if (notification) {
// launched from notification
} else {
// from the springboard
}
}
在您的
UIApplicationDelegate
中。关于iOS/XCode : how to know that app has been launched with a click on notification or on springboard app icon?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/12937359/