IP Address

Is there a way to gather an IP address programmatically that is still acceptable by privacy standards? I see a lot of talk about using getifaddrs() but most of those threads are very old and there doesnt seem to be a lot of other options

Answered by granada29 in 792798022

getifaddrs() will return the IPv4 & IPv6 addresses of each interface. This in most cases, especially for IPv4, will be an address on the users local network.

If you're after the users public IP address you will have to use some other method, such as visiting one of the many sites on the internet, via an http(s) request, that will reply with the connecting address.

getifaddrs() will return the IPv4 & IPv6 addresses of each interface. This in most cases, especially for IPv4, will be an address on the users local network.

If you're after the users public IP address you will have to use some other method, such as visiting one of the many sites on the internet, via an http(s) request, that will reply with the connecting address.

Accepted Answer

What granada29 said plus…

I have a bunch of extra info about getifaddrs and friends in the various posts hanging off Extra-ordinary Networking.

On the privacy front, that’s not something I can help you with. App Review has the final say on what is allowed on the store. They have a bunch of public info which you can access via Developer > Distribute > App Review Guidelines.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

IP Address
 
 
Q