Swift - 在没有推送通知的情况下启动应用程序 [英] Swift - Launch the application without push notification

查看:51
本文介绍了Swift - 在没有推送通知的情况下启动应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am working with a project which requires when there is a notification from backend it will automatically launch the application from background or even after the device is restarted. However, from my knowledge, Apple doesn't allow us to do that. I made some researches and there is callkit. However, callkit is a little bit too much for me (because i don't need the VOIP). But, I need something quite similar (like whatsapp or hangouts )

流程应该是这样的:后端通知 -> 应用程序将拨打类似 whatsapp/hangouts 的电话 -> 用户接受 -> 应用程序以特定视图自行启动(根本不是呼叫)

The flow should be like: Backend notification -> App will make a call like whatsapp/hangouts -> user accept -> application launches itself with a specific view ( not the call at all )

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

NOTE: I did try the push notification. However, the push notification requires users' action (actually tap the notification) and I need something else.

有人给我建议吗?

谢谢

推荐答案

如果我没猜错,如果您不想使用 CallKit,Apple 推送通知服务是唯一可以帮助您的服务.要模拟 WhatsApp 和 Hangouts 之类的通话,您可以使用 Apple 新的高级通知来自定义通知用户界面(从 iOS 10.0 开始提供).

If I get it right, the Apple Push Notification service is the only service that can help you, if you do not want to use CallKit. To simulate a call like WhatsApp and Hangouts, you can use Apple's new Advanced Notifications for customized notification UI (available from iOS 10.0).

https://developer.apple.com/library/内容/文档/NetworkingInternet/Conceptual/RemoteNotificationsPG/

Apple 推送通知服务 (APNs) 是远程通知功能的核心.它是一种强大、安全且高效的服务,可供应用开发者将信息传播到 iOS(以及间接的 watchOS)、tvOS 和 macOS 设备.

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.

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

More about Advanced Notifications:

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

这篇关于Swift - 在没有推送通知的情况下启动应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆