简体   繁体   English

请求在模拟器与设备上返回不同的数据

[英]Request returns different data on simulator vs device

When I make a request for a webpage on the simulator I get the HTML, but when I make the request from the device (I tried on wifi and cellular networks). 当我在模拟器上请求一个网页时,我得到了HTML,但是当我从设备发出请求时(我在wifi和蜂窝网络上尝试过)。 This happens consistently. 这是一致发生的。

What would cause this? 是什么原因造成的?

EDIT: This is what is returning for me on the device, on the simulator I get the real page: 编辑:这就是在设备上返回给我的东西,在模拟器上我得到了真实的页面:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>

<head>

<title>Error</title>

<meta name=vs_defaultClientScript content="JavaScript">

<meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5">

<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">

<meta name=ProgId content=VisualStudio.HTML>

<meta name=Originator content="Microsoft Visual Studio .NET 7.1">

<link rel="stylesheet" id="style" runat="server" type="text/css" href="Data/style/mojo1.css" />

</head>

<body >

<br /><br />

<table ID="Table1">

<tr>

    <td width="100"></td>

    <td align="center">



    </td>
</tr>

<tr>

    <td width="100"></td>

    <td width="500">

        <p style="font-family:arial sans-serif;font-size:large">

        Sorry!

        </p>

        <p style="font-family:arial sans-serif;font-size:large">

        A server error has occurred.<br />

        The error has been logged and will be reviewed as soon as possible.

        It may have been a momentary problem; use the back button to try again or go back to the

        <a href="http://metrotransit.org/home.aspx">home</a> page.

        For assistance, call 612-373-3333 to speak with a transit representative.

        </p>

    </td>

</tr>

</table>

</body>

</html>

EDIT: I know it's not the User Agent. 编辑:我知道这不是用户代理。 I made a custom configuration and the issue continues. 我进行了自定义配置,问题仍然存在。

EDIT: Issue continues with NSURLRequest as well as NSURLSession. 编辑:NSURLRequest和NSURLSession的问题继续。

It is working for me!!! 它为我工作!!!

My code is as follow: 我的代码如下:

-(IBAction)web_pressed:(id)sender
{
    [[UIApplication sharedApplication]openURL:[NSURL URLWithString:@"http://metrotransit.org/"]];
}

Let me know if you have any problem. 如果您有任何问题,请告诉我。

My phone was in my native language which is not english. 我的电话使用的是我的母语,不是英语。 Changing hardware phone's language to english solved the problem. 将硬件电话的语言更改为英语可以解决此问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM