This question already has an answer here:
I got a webserver up and running in iphone by using Mongoose. But the problem is how can I get the ip address of my iphone/ipad to let the user's know where they can access the server. I found that [NSHost addresses]
can do the job but I am developing for app store and this is undocumented method.
https://web.archive.org/web/20160527165909/http://www.makebetterthings.com/iphone/how-to-find-ip-address-of-iphone/
I believe
[NSHost address];
is documented, it's listed here: http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSHost_Class/Reference/Reference.htmlUse
[[NSHost currentHost] address];
to get the IP.