Reputation: 17530
First of all, I know I can use UIRequiresPersistentWiFi
to specify that my app needs WiFi.
But in fact, my app works fine with both WiFi or 3G. How can I express such a network requirement? It there any Info.plist
key for this? Or is testing myself with Reachability
the only way to go?
Upvotes: 3
Views: 1479
Reputation: 89509
My suggestion would be use SCNetworkReachabilitySetCallback
(which gets called whenever the status of the network changes) and then throw an error if there's no WiFi or 3G connection.
b.t.w., all the keys UIKit supports in Info.plist can be seen at http://developer.apple.com/library/ios/#documentation/general/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html
Upvotes: 2
Reputation: 185671
What exactly are you trying to do? If all you need is network access, then you don't have to do anything at all to make it work. Reachability can be useful, because it lets you quickly test if the network is available before attempting to connect anywhere, but that's only useful if you need to know if there is a network before even attempting to use it. Under normal circumstances, you can just attempt to use the network, and gracefully handle any errors that may occur.
Upvotes: 3