简体   繁体   中英

IOS send request to HTTP server when app received notification

I'm new in IOS development, and i try to work with push notifications

According to this article :

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.

In Android development i have a Service which handle all PUSH-messages in application and i can send HTTP request from him when app received PUSH-message.

So i have a question - how i can do the same thing in IOS? (Send HTTP-request when app received PUSH-notification)

If you app is in Foreground then its possible to make http call from delegate method. But if its in background mode then its not possible.

Alternatively you can do one thing if its feasible at your end. Whenever the notification will be generate it will be generated from the server so at the same time you can make call to your require http function.

If that is not possible then you can set certain setting on server & based on that when user open the application next time, You can make call to http request.

Hope this helps you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM