获取 iPhone 应用程序的特定 IP 位置
我已浏览以下链接
http://zachwaugh.com /2009/03/programmatically-retriving-ip-address-of-iphone/
我也尝试过这个(但这不被苹果识别)。
http://appsamuck.com/day4.html
我只想当用户点击“wifi”时按钮。
存储在文档目录中的报告可以由其他电脑通过 Wi-Fi 使用我在 iPhone 应用程序上显示的 IP 进行访问。怎么可能呢?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在我的应用中,我使用 CocoaHTTPServer 将本地信息传入和传出手机。您运行服务器并且开箱即用,它会索引文档目录中的所有文件。
要执行您想要的操作,您需要编辑代码以返回某种其他类型的数据格式(xml 可能是最简单的),从您的应用程序内部调用它来获取该数据。 CocoaHTTPServer 也可以轻松地直接使用 POST,因此您也可以发布 xml 响应。
想了想,CocoaHTTPServer最好运行在后台的计算机端。然后 iPhone 可以将信息发送到计算机,在计算机上处理代码应该更容易,并且您有更多选择。
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.
我无法指出任何具体示例,但实现此目的的方法是 ZeroConf 协议 - iPhone 和 PC 必须位于同一网络上才能实现此功能。
I can't point to any specific examples but the way to do this would be the ZeroConf protocol - both the iPhone and PC would have to be on the same network to have this work.