iPhone SDK Internet connection detection

后端 未结 3 2017
执念已碎
执念已碎 2020-12-02 05:33

I\'m working on an iPhone application that makes a few calls to web services. I posted this application on the Apple store but it got rejected (and rightly so) since there w

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-02 06:00

    If your application must have network access the easiest way is to add the following settings to your info.plist as boolean values.

    • SBUsesNetwork - Ensure the device has an active connection (Edit: not applicable, this seems to be a private API someone found at some point. It is not in Apple's developer documentation.)
    • UIRequiresPersistentWiFi - Ensures the device is connected via WiFi

    If your choice is not true then the user will be presented with an appropriate message when starting your application. Best of all this message is from the OS and thus is localized.

    If your application cannot download data from a website while running (loss of signal, site down) you should still warn the user though and not just spin indefinitely.

提交回复
热议问题