gpt4 book ai didi

ios - 如果应用程序未运行(解析),则保存来自 ios 推送通知的数据

转载 作者:行者123 更新时间:2023-11-28 13:14:08 25 4
gpt4 key购买 nike

我正在使用解析推送通知服务。

如果我的应用程序正在运行,我会在以下委托(delegate)函数中从我的通知中获取数据。

func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {
PFPush.handlePush(userInfo)
println(userInfo)
if application.applicationState == UIApplicationState.Inactive {

}
}

但如果我的应用程序未运行,并且生成了通知,那么我不知道哪个函数用于生成该通知并从该通知获取数据。

最佳答案

如果您的应用未运行(后台或前台),那么获取通知负载数据的唯一方法是当用户通过点击通知打开您的应用时。如果发生这种情况,您可以使用 didFinishLaunchingWithOptions 方法来检索数据。除此之外,存储负载数据的最佳方式是在发送通知时将其存储在服务器端数据库中。然后您可以随时发出检索通知的请求。这还将为您提供管理角标(Badge)计数的机制。

关于ios - 如果应用程序未运行(解析),则保存来自 ios 推送通知的数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29930725/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com