Is it possible to send a request when the phone is in sleep mode? A push notification arrives, after that, you must send a request to the server, but when the phone is in sleep mode, the request is not sent.
Is it possible to fix this?
Is it possible to send a request when the phone is in sleep mode? A push notification arrives, after that, you must send a request to the server, but when the phone is in sleep mode, the request is not sent.
Is it possible to fix this?
It seems that you need to set the right background mode
When the device is in sleep mode, applications are frozen and cannot perform any operations, but there are a few exceptions:
Actually, you need to show the system that the application wants to work in mode number 8. To do this, set the remote-notification value in the UIBackgroundModes parameter in the project Info.plist file.
Next you need to implement the method
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))handler { ... } in AppDelegate . However, according to the documentation, all this is intended for downloading content when a push appears, so that the user, after opening the notification in the application, does not wait for the data to be downloaded, but immediately sees the information. To do this, the message must be set the content-available flag, otherwise the miracle will not happen.
remote-notification is specified, the notification content is processed, but there is no internet connection. - Vitali EllerNSURLSession , can try through it? Generally, is there any error or is the object not created to send the data? Or the handler is not called at all? - Andrey ChevozerovSource: https://ru.stackoverflow.com/questions/475304/
All Articles