UIRequiresPersistentWiFi equivalent for cellular

OK, so I pointed out the UIRequiresPersistentWiFi key of my application on YES , so that iOS does not stop retrieving data when my application is in the background.

However, when a user uses cellular (not Wi-Fi) and my application is in the background, the data download stops after a few minutes.

I double-checked the docs, and there seems to be no equivalent of UIRequiresPersistentWiFi for the cellular network that I could install.

Is there a way in which I can connect to the cellular network when the application is in the background? Any clues?

Hurrah!

Update:

I am making an application for internet radio. Stream is combined with mp3s, which I request one by one (I can not request them in advance, I can not change the server). It works when my application is in the background and uses wifi. However, when using a cellular connection, network requests are not completed after some time spent in the background. You can not change the strategy. The application is in the AppStore, and it worked before. I assume that they have changed something in the new version of the system.

The more I don’t need throttling. My radio application is already approved and is in the AppStore. The stream is sent from 128 kb / s (this is the maximum), so this is not a problem. It seems like the system is disconnecting my network requests (when on the cellular network) after a while in the background. However, this only happens when I try to start a connection in the background.

Description:

  • App is in the background, playing mp3 transmitted over a cellular network.
  • MP3 ends.
  • I am requesting the url of another mp3
  • Request failed *.

* Works when using WiFi.

+6
source share
3 answers

I'm pretty sure there is nothing like this for cellular networks. Here are my thoughts:

  • Cellular service costs money. Much money. Per minute. Wifi service is not worth the money in comparison.
  • AT&T does not have much bandwidth and charges users additional bandwidth charges.
  • Apple is a company that wants to make the user experience as clean and enjoyable as possible.
  • When costs are exorbitant of their own fault, users get angry and their experience is not very pleasant.

If Apple allows you to constantly connect to networks outside the Wi-Fi range, the cost of customer service will skyrocket, and they won’t know why. And if Apple provides programmers with this ability, someone will abuse it. So, I'm sure Apple will not let you do this.

Why do you need to constantly connect to the Internet when your application is in the background (if, I suppose, you are making an Internet radio application)? Keep in mind that in the background your application may be terminated without warning at any time. You can rethink your strategy if you cannot find a way to do this.: /

+10
source

I think there is no equivalent to UIRequiresPersistentWiFi , there are probably those listed by Tusting2121.

But UIRequiresPersistentWiFi that UIRequiresPersistentWiFi is related to energy conservation. The wifi module consumes power, so it usually shuts down after a while to save some power if UIRequiresPersistentWiFi not installed. I believe that such economic conservation is not relevant to the cellular business.

And the fact that your connection disappears after certain minutes in the cellular mode may be caused by something completely different than the copy of the Wi-Fi energy-saving mechanism that you are claiming. See, for example, in this article , which says that you are required to throttle the 3G data stream.

+1
source

Add audio to your UIBackgroundModes entry in Info.plist .

According to Apple Docs: In your callbacks, though, you should do only the work necessary to provide data for playback. For example, a streaming audio app would need to download the music stream data from its server and push the current audio samples out for playback. You should not perform any extraneous tasks that are unrelated to playback. In your callbacks, though, you should do only the work necessary to provide data for playback. For example, a streaming audio app would need to download the music stream data from its server and push the current audio samples out for playback. You should not perform any extraneous tasks that are unrelated to playback.

You can also get some value from the voip entry - you can setKeepAliveTimeout:handler: so that your handler calls on a periodic basis to populate your data stream.

+1
source

Source: https://habr.com/ru/post/905907/


All Articles