从本地通知启动关闭的 iOS 应用程序 [英] Launch Closed iOS App From Local Notification
问题描述
当我的 iOS 应用程序在后台运行时,它响应良好
When my iOS application is running in the background it responds fine to
- (void)application:(UIApplication *)application didReceiveLocalNotification:
(UILocalNotification *)notification
但是当应用程序关闭时它会崩溃并给出SIGKILL错误.
but when the application is closed it crashes and gives a SIGKILL error.
如果在收到通知时关闭了应用程序中的方法,我该如何运行?
How can I run a method within the app if it is closed when the notification is received?
推荐答案
当收到本地通知时,您无法在应用中运行方法.通知可以提供警报、图标徽章编号和声音(<30 秒)的任意组合.
You can't run a method in the app when a local notification is received. The notification can provide any combination of an alert, icon badge number, and a sound (<30 secs).
当一个方法再次进入前台时,您可以通过通知或其他方式运行它.
You can run a method when it comes into the foreground again either through the notification or through other means.
当应用处于后台时,它将在恢复之前调用 applicationWillEnterForeground:
.您可以覆盖此方法以处理通知后所需的任何内容.您可以覆盖 applicationDidEnterBackground:
以确定您的应用何时真正进入后台.
When the app is in the background it will call applicationWillEnterForeground:
prior to resuming. You can override this method to handle anything needed after the notification. You can override applicationDidEnterBackground:
to determine when your app actually enters the background.
方法 application:didReceiveLocalNotification:
当应用收到通知但在前台时调用.应用在前台时不会触发警报、图标徽章编号和声音.
Method application:didReceiveLocalNotification:
is called when the app receives a notification but is in the foreground. The alert, icon badge number, and sound will not be triggered when the app is in the foreground.
这篇关于从本地通知启动关闭的 iOS 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!