OGeek|极客世界-中国程序员成长平台

标题: ios - Swift - 在没有推送通知的情况下启动应用程序 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-11 19:54
标题: ios - Swift - 在没有推送通知的情况下启动应用程序

我正在处理一个项目,该项目要求当有来自后端的通知时,它会自动从后台启动应用程序,甚至在设备重新启动后。但是,据我所知,Apple 不允许我们这样做。我做了一些研究,并且有 callkit。但是,callkit 对我来说有点太多了(因为我不需要 VOIP)。但是,我需要一些非常相似的东西(比如 whatsapp 或 hangouts )

流程应该是这样的: 后端通知 -> 应用程序将调用类似 whatsapp/hangouts -> 用户接受 -> 应用程序以特定 View 启动自身(根本不是调用)

注意:我确实尝试过推送通知。但是,推送通知需要用户的操作(实际上是点击通知),而我需要别的东西。

有人给我建议吗?

谢谢



Best Answer-推荐答案


如果我没记错的话,如果您不想使用 CallKit,Apple 推送通知服务是唯一可以帮助您的服务。要模拟 WhatsApp 和环聊等通话,您可以使用 Apple 新的高级通知来定制通知 UI(从 iOS 10.0 开始提供)。

https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/

Apple Push Notification service (APNs) is the centerpiece of the remote notifications feature. It is a robust, secure, and highly efficient service for app developers to propagate information to iOS (and, indirectly, watchOS), tvOS, and macOS devices.

Local notifications and remote notifications are ways to inform users when new data becomes available for your app, even when your app is not running in the foreground. For example, a messaging app might let the user know when a new message has arrived, and a calendar app might inform the user of an upcoming appointment.

有关高级通知的更多信息:

https://developer.apple.com/videos/play/wwdc2016/708/

关于ios - Swift - 在没有推送通知的情况下启动应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44668629/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4