ios - Swift - 在没有推送通知的情况下启动应用程序

标签 ios swift notifications

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

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

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

有人给我建议吗?

谢谢

最佳答案

如果我没弄错的话,如果您不想使用 CallKit,Apple 推送通知服务是唯一可以帮助您的服务。要模拟 WhatsApp 和 Hangouts 之类的通话,您可以使用 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/

相关文章:

ios - 环球银行金融电信协会2 : Core Data does not seem to work

iphone - 检测两个图像是否在 Objective-C 中发生碰撞并打印消息

ios - 当我在 CollectionView 中向下滚动时图片消失

ios - 使用 AFNetworking 从 AVCapture 上传文件

notifications - 如何从 Java 呈现漂亮的桌面通知?

ios - 如何安排和重复本地通知

ios - gateway.push.apple.com 和 api.push.apple.com 之间的区别

iphone - UINavigationController 过渡动画触发得太快

ios - 从 Xib 加载的 UIView 不能正确应用 AutoLayout

ios - 当 UIViews 在层次结构中时,将两个 UIViews 转换到相同的坐标系