How to run socket.io in the background on iOS in a React Native app?

前端 未结 4 1865
轮回少年
轮回少年 2021-02-07 02:36

I am using socket.io in an iOS React Native(v0.20) app. The app tracks my location, and when my position changes it emits a message to a server. If the

4条回答
  •  我在风中等你
    2021-02-07 03:03

    iOS is fairly restrictive on the kind of processes it allows when an app is backgrounded.

    There seems to be some discussion around this on the socket.io client issue tracker.

    It seems someone got the socket connection to remain active if they set the background mode to audio. YMMV

    Make sure you're setting the correct values in the UIBackgroundModes section of the Info.plist file. How to do this in XCode

提交回复
热议问题