gpt4 book ai didi

当应用程序收到通知时,IOS 向 HTTP 服务器发送请求

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:14:52 27 4
gpt4 key购买 nike

我是 IOS 开发的新手,我尝试使用推送通知

根据 this文章:

When the user’s device receives the push notification, it shows an alert, plays a sound and/or updates the app’s icon. The user can launch the app from the alert. The app is given the contents of the push notification and can handle it as it sees fit.

Android 开发中,我有一个服务,它处理应用程序中的所有推送消息,当应用程序收到推送消息时,我可以从他那里发送 HTTP 请求。

所以我有一个问题 - 我如何在 IOS 中做同样的事情? (当应用程序收到推送通知时发送 HTTP 请求)

最佳答案

如果您的应用程序在前台,则可以从委托(delegate)方法进行 http 调用。但如果它处于后台模式,则不可能。

或者,如果可行,您也可以做一件事。每当生成通知时,它都会从服务器生成,因此您可以同时调用您的 require http 函数。

如果那不可能,那么您可以在服务器上设置某些设置,并基于此设置,当用户下次打开应用程序时,您可以调用 http 请求。

希望对你有帮助。

关于当应用程序收到通知时,IOS 向 HTTP 服务器发送请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30868627/

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