iPhone IP address

Looking to extract the IP address from an iPhone. The App is written in Swift. Is there an easy way to get the IP address from the device?


thank you

An iPhone doesn’t just have one IP address, it has a set of network interfaces each of which has a (possibly empty) set of IPv4 addresses and a (possibly empty) set of IPv6 addresses. You can get this information by calling

getifaddrs
.

My experience is that most folks who ask this question are not prepared to deal with the complexity of the answer. If you post more details about what you plan to do with this “IP address”, I should be able to offer more concrete advice.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

WWDC runs Mon, 13 Jun through to Fri, 17 Jun. During that time all of DTS will be at the conference, helping folks out face-to-face. http://developer.apple.com/wwdc/

iPhone IP address
 
 
Q