In that case any dns lookups your iPhone does will use the hosts file of the machine Fiddler is running on. Note, though, that you must use a name that will be resolved via DNS. example.local, for instance, will not work. example.xyz or example.dev will.
您有什么品牌的路由器?您的路由器固件可能允许您为本地网络设置 DNS 记录。这就是我对 Tomato 固件 所做的事情
This doesn't directly answer your question, but it does solve your problem...
What make of router do you have? Your router firmware may allow you to set DNS records for your local network. This is what I do with the Tomato firmware
假设您的开发网络服务器位于 Mac 上,为什么不直接使用其 Bonjour 名称(例如 MyMac.local.)而不是 myrealwebserverontheinternet.com?
It might exist, but you cannot change it on a non-jailbreaked iPhone.
Assuming that your development webserver is on a Mac, why don't you simply use its Bonjour name (e.g. MyMac.local.) instead of myrealwebserverontheinternet.com?
As far as the server is concerned, it will behave the exact same way as if you had used http://myserver/mypage.php, except that the iPhone will not have to do a DNS lookup.
在我的办公室,我们有带有内部 DNS 的内部服务器,这些服务器不暴露在互联网上。我只需将 iPhone 连接到办公室 wifi,然后就可以正常访问它们。
YMMV,但我觉得不配置手机 DNS,只设置本地内部 DNS 和 wifi 是一个更干净、更简单的解决方案。
Don't change the DNS on the phone. Instead, connect with wifi to the local network and you are all set.
At my office, we have internal servers with internal DNS that are not exposed to the Internet. I just connect with iPhone to the office wifi and can then access them fine.
YMMV, but instead of configuring the phone DNS, it feels to me that just setting up local internal DNS and wifi is a cleaner and easier solution.
您最好的选择可能是使用服务器 IP 地址而不是主机名。稍微困难一点,但如果您只需要解析单个地址,那么那么并不困难,那就是在您的 Mac 上放置一个 DNS 服务器并配置您的 iPhone 以使用该服务器。
No, an iPhone application can only change stuff within its own little sandbox. (And even there there are things that you can't change on the fly.)
Your best bet is probably to use the servers IP address rather than hostname. Slightly harder, but not that hard if you just need to resolve a single address, would be to put a DNS server on your Mac and configure your iPhone to use that.
发布评论
评论(8)
这里的另一个选择是让您的 iPhone 通过代理进行连接。以下是如何使用 Fiddler 执行此操作的示例(非常简单):
http://conceptdev.blogspot.com/2009/01/monitoring-iphone-web-traffic-with.html
在这种情况下,您的 iPhone 所做的任何 dns 查找都将使用机器 Fiddler 的主机文件正在运行。 请注意,但您必须使用将通过 DNS 解析的名称。例如,
example.local
将不起作用。example.xyz
或example.dev
将会。Another option here is to have your iPhone connect via a proxy. Here's an example of how to do it with Fiddler (it's very easy):
http://conceptdev.blogspot.com/2009/01/monitoring-iphone-web-traffic-with.html
In that case any dns lookups your iPhone does will use the hosts file of the machine Fiddler is running on. Note, though, that you must use a name that will be resolved via DNS.
example.local
, for instance, will not work.example.xyz
orexample.dev
will.这并没有直接回答您的问题,但它确实解决了您的问题...
您有什么品牌的路由器?您的路由器固件可能允许您为本地网络设置 DNS 记录。这就是我对 Tomato 固件 所做的事情
This doesn't directly answer your question, but it does solve your problem...
What make of router do you have? Your router firmware may allow you to set DNS records for your local network. This is what I do with the Tomato firmware
与编程无关,但我还是会回答。它位于
/etc/hosts
中。您可以使用简单的文本编辑器(例如
nano
)更改它。(显然你需要一个越狱的 iPhone 才能做到这一点)
Not programming related, but I'll answer anyway. It's in
/etc/hosts
.You can change it with a simple text editor such as
nano
.(Obviously you would need a jailbroken iphone for this)
我刚刚成功编辑了 iPhone 的“hosts”文件(在越狱的 iOS 4.0 上)。
simophone.local
]root
alpine
/etc/hosts
文件手机确实会缓存一些网页和 DNS 查询,因此重新启动或清除缓存可能会有所帮助。希望对某人有帮助。
西蒙。
I just edited my iPhone's 'hosts' file successfully (on Jailbroken iOS 4.0).
simophone.local
]root
alpine
/etc/hosts
fileThe phone does cache some webpages and DNS queries, so a reboot or clearing the cache may help. Hope that helps someone.
Simon.
它可能存在,但您无法在未越狱的 iPhone 上更改它。
假设您的开发网络服务器位于 Mac 上,为什么不直接使用其 Bonjour 名称(例如
MyMac.local.
)而不是myrealwebserverontheinternet.com
?It might exist, but you cannot change it on a non-jailbreaked iPhone.
Assuming that your development webserver is on a Mac, why don't you simply use its Bonjour name (e.g.
MyMac.local.
) instead ofmyrealwebserverontheinternet.com
?如果其他人进入此页面,您还可以通过使用 URL 请求中的 Ip 地址而不是域来解决此问题:
然后手动指定主机:
就服务器而言,它的行为方式完全相同就像您使用了
http://myserver/mypage.php
一样,只不过 iPhone 不需要进行 DNS 查找。100% 公共 API。
In case anybody else falls onto this page, you can also solve this by using the Ip address in the URL request instead of the domain:
Then you specify the Host manually:
As far as the server is concerned, it will behave the exact same way as if you had used
http://myserver/mypage.php
, except that the iPhone will not have to do a DNS lookup.100% Public API.
不要更改手机上的 DNS。相反,通过 wifi 连接到本地网络,一切就完成了。
在我的办公室,我们有带有内部 DNS 的内部服务器,这些服务器不暴露在互联网上。我只需将 iPhone 连接到办公室 wifi,然后就可以正常访问它们。
YMMV,但我觉得不配置手机 DNS,只设置本地内部 DNS 和 wifi 是一个更干净、更简单的解决方案。
Don't change the DNS on the phone. Instead, connect with wifi to the local network and you are all set.
At my office, we have internal servers with internal DNS that are not exposed to the Internet. I just connect with iPhone to the office wifi and can then access them fine.
YMMV, but instead of configuring the phone DNS, it feels to me that just setting up local internal DNS and wifi is a cleaner and easier solution.
不,iPhone 应用程序只能在自己的小沙箱内更改内容。 (即使有些事情您也无法即时更改。)
您最好的选择可能是使用服务器 IP 地址而不是主机名。稍微困难一点,但如果您只需要解析单个地址,那么那么并不困难,那就是在您的 Mac 上放置一个 DNS 服务器并配置您的 iPhone 以使用该服务器。
No, an iPhone application can only change stuff within its own little sandbox. (And even there there are things that you can't change on the fly.)
Your best bet is probably to use the servers IP address rather than hostname. Slightly harder, but not that hard if you just need to resolve a single address, would be to put a DNS server on your Mac and configure your iPhone to use that.