Retrieve local IPv4/IPv6 on Wifi/Cellular on iPhone

On iOS, you want to know your local IP (for example, when an application opens a webpage on the wifi interface) but the iOS SDK provides no simple way to get the IP Address for the wifi connection.

I found an interesting Method in Objective-C which retrieve the IPv4 address of the wifi connexion as a NSString on Zach Waugh’s blog.

Sadly it doesn’t work with IPv6. So I modified it and here is the code:

http://wiki.gonzofamily.com/a/Retrieve_local_IPv4/IPv6_on_Wifi/Cellular

Leave a Reply

Your email address will not be published. Required fields are marked *