Search code examples
iphoneobjective-cxcodewififileshare

Getting the specific IP location for iPhone application


I have gone through following link

http://zachwaugh.com/2009/03/programmatically-retrieving-ip-address-of-iphone/

and I have also tried this one (but this isn't recognized by Apple).

http://appsamuck.com/day4.html

I just want that when user tap on "wifi" button.

Reports stored in documents directory can be accessed by other pc using wifi using the IP that I display on my iPhone application. How is it possible?


Solution

  • In my apps, I use CocoaHTTPServer to get local info into and off of the phone. You run the server and out-of-the-box, it indexes all the files in the documents directory.

    To do what you want, you will need to edit the code to return some other kind of data format (xml probably is the easiest) the call this from inside your app to get that data. CocoaHTTPServer easily take POST right out of the box too, so you can post an xml response as well.

    After thinking about it, CocoaHTTPServer is best run on the computer side behind the scenes. the iphone can then send info to the computer where handling the code should be easier and you have more options.