We have an app wherein certain functionality needs to work only when the user is connected to a router associate开发者_运维百科d with his account (we have some information about user accounts and home routers). However, it is possible for the user to set up a VPN connection to his home router via any public wifi/3g network. We want to block certain functionality if that is the case.
Any ideas as to how it can be detected using any of the existing iphone/ipad apis?
Thanks, Hetal
There is a flag in the reachability API called kSCNetworkReachabilityFlagsTransientConnection. It is true when you are connected via a VPN and false if you are not connected via a VPN. We used this flag value to check for our conditions.
There's no iOS API (public at least) that is going to give you information on whether you're running on a home router or public WiFi connection. You can only determine that you're on a WiFi connection vs. 3G. (for example, see the Reachability sample)
You might be able to do some sort of lookup based on the device's current IP address. You'd have to have each user register their router's IP address and have your application validate it before running, etc. But still, there'd be no guarantee that user's home router is secured. In other words, it could be just as wide open as a public WiFi.
精彩评论