画面オフ時に WiFi 接続をキープする方法
iPad間で WiFi や Bluetooth 通信させるアプリを作ってるんだけど、通信中に画面がオフになるとセッションが切れちゃうのが困りもん。
接続をキープさせる方法ないかな〜と思ってたら、WiFi なら UIKit キー でUIRequiresPersistentWiFi=YES にすると、プロセスが動いている間は維持できるっぽい。:-)
UIRequiresPersistentWiFi (Boolean - iOS) specifies whether the application requires a Wi-Fi connection. iOS maintains the active Wi-Fi connection open while the application is running.
UIRequiresPersistentWiFi
デフォルトはオフ(No) で30分で切れるそうな。今まで UIKit Keys でどんな設定ができるか、ちゃんと見てなかったけど、やっぱ押さえとかないといけませんなぁ ^^;)
Value | Description |
YES | iOS opens a Wi-Fi connection when this application is launched and keeps it open while the application is running. Use with Wi-Fi–based applications. |
NO | (Default) iOS closes the active Wi-Fi connection after 30 minutes. |
あとは Bluetooth の方を解決できれば御の字だね :-)