Ошибка 1001 http

I am using the following code to post an image to my server.

@IBAction func postButtonPressed(sender: UIButton) {
    let task = NSURLSession.sharedSession().dataTaskWithRequest(createRequest("http://xx.xx.xxx.xxx/xxxx/"), completionHandler: {
        data, response, error in
        println(NSString(data: data, encoding: NSUTF8StringEncoding))
    })
    task.resume()
}

where createRequest() creates the required NSURLRequest object.

This works fine when I use a simulator. The problem is that I am getting the following error when I run my app on an iPhone.

Error Domain=NSURLErrorDomain Code=-1001 "The operation couldn’t be completed. (NSURLErrorDomain error -1001.)" UserInfo=0x155e71f0 {NSErrorFailingURLKey=http://xx.xxx.xxx.xxx/xxxx/, NSErrorFailingURLStringKey=http://54.148.156.117/query/, NSUnderlyingError=0x155674d0 "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1001.)"}

I have learned that this error is a timeout error. Restarting the app or phone didn’t helped. Moreover I have tried posting an image to my server from a web browser and it worked with no problem.

What might be causing this timeout error?

EDIT: When I monitor my network activity, I realized the app sends 10 MB data even though the image that I am sending is 0.1 MB.

Я использую следующий код для размещения изображения на моем сервере.

@IBAction func postButtonPressed(sender: UIButton) {
    let task = NSURLSession.sharedSession().dataTaskWithRequest(createRequest("http://xx.xx.xxx.xxx/xxxx/"), completionHandler: {
        data, response, error in
        println(NSString(data: data, encoding: NSUTF8StringEncoding))
    })
    task.resume()
}

где createRequest() создает необходимый объект NSURLRequest.

Это отлично работает, когда я использую симулятор. Проблема в том, что я получаю следующую ошибку при запуске приложения на iPhone.

Error Domain=NSURLErrorDomain Code=-1001 "The operation couldn’t be completed. (NSURLErrorDomain error -1001.)" UserInfo=0x155e71f0 {NSErrorFailingURLKey=http://xx.xxx.xxx.xxx/xxxx/, NSErrorFailingURLStringKey=http://54.148.156.117/query/, NSUnderlyingError=0x155674d0 "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1001.)"}

Я узнал, что эта ошибка является ошибкой таймаута. Перезапуск приложения или телефона не помогло. Кроме того, я попытался разместить изображение на своем сервере из веб-браузера, и он работал без проблем.

Что может вызвать эту ошибку тайм-аута?

EDIT:. Когда я отслеживаю активность в сети, я понял, что приложение отправляет 10 МБ данных, хотя изображение, которое я отправляю, составляет 0,1 МБ.

I am using the following code to post an image to my server.

@IBAction func postButtonPressed(sender: UIButton) {
    let task = NSURLSession.sharedSession().dataTaskWithRequest(createRequest("http://xx.xx.xxx.xxx/xxxx/"), completionHandler: {
        data, response, error in
        println(NSString(data: data, encoding: NSUTF8StringEncoding))
    })
    task.resume()
}

where createRequest() creates the required NSURLRequest object.

This works fine when I use a simulator. The problem is that I am getting the following error when I run my app on an iPhone.

Error Domain=NSURLErrorDomain Code=-1001 "The operation couldn’t be completed. (NSURLErrorDomain error -1001.)" UserInfo=0x155e71f0 {NSErrorFailingURLKey=http://xx.xxx.xxx.xxx/xxxx/, NSErrorFailingURLStringKey=http://54.148.156.117/query/, NSUnderlyingError=0x155674d0 "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1001.)"}

I have learned that this error is a timeout error. Restarting the app or phone didn’t helped. Moreover I have tried posting an image to my server from a web browser and it worked with no problem.

What might be causing this timeout error?

EDIT: When I monitor my network activity, I realized the app sends 10 MB data even though the image that I am sending is 0.1 MB.

Я использую следующий код для размещения изображения на моем сервере.

@IBAction func postButtonPressed(sender: UIButton) {
    let task = NSURLSession.sharedSession().dataTaskWithRequest(createRequest("http://xx.xx.xxx.xxx/xxxx/"), completionHandler: {
        data, response, error in
        println(NSString(data: data, encoding: NSUTF8StringEncoding))
    })
    task.resume()
}

где createRequest() создает необходимый объект NSURLRequest.

Это отлично работает, когда я использую симулятор. Проблема в том, что я получаю следующую ошибку при запуске приложения на iPhone.

Error Domain=NSURLErrorDomain Code=-1001 "The operation couldn’t be completed. (NSURLErrorDomain error -1001.)" UserInfo=0x155e71f0 {NSErrorFailingURLKey=http://xx.xxx.xxx.xxx/xxxx/, NSErrorFailingURLStringKey=http://54.148.156.117/query/, NSUnderlyingError=0x155674d0 "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1001.)"}

Я узнал, что эта ошибка является ошибкой таймаута. Перезапуск приложения или телефона не помогло. Кроме того, я попытался разместить изображение на своем сервере из веб-браузера, и он работал без проблем.

Что может вызвать эту ошибку тайм-аута?

EDIT:. Когда я отслеживаю активность в сети, я понял, что приложение отправляет 10 МБ данных, хотя изображение, которое я отправляю, составляет 0,1 МБ.

I am using the following code to post an image to my server.

@IBAction func postButtonPressed(sender: UIButton) {
    let task = NSURLSession.sharedSession().dataTaskWithRequest(createRequest("http://xx.xx.xxx.xxx/xxxx/"), completionHandler: {
        data, response, error in
        println(NSString(data: data, encoding: NSUTF8StringEncoding))
    })
    task.resume()
}

where createRequest() creates the required NSURLRequest object.

This works fine when I use a simulator. The problem is that I am getting the following error when I run my app on an iPhone.

Error Domain=NSURLErrorDomain Code=-1001 "The operation couldn’t be completed. (NSURLErrorDomain error -1001.)" UserInfo=0x155e71f0 {NSErrorFailingURLKey=http://xx.xxx.xxx.xxx/xxxx/, NSErrorFailingURLStringKey=http://54.148.156.117/query/, NSUnderlyingError=0x155674d0 "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1001.)"}

I have learned that this error is a timeout error. Restarting the app or phone didn’t helped. Moreover I have tried posting an image to my server from a web browser and it worked with no problem.

What might be causing this timeout error?

EDIT: When I monitor my network activity, I realized the app sends 10 MB data even though the image that I am sending is 0.1 MB.

http

Код ответа HTTP 101 Switching Protocols указывает на протокол,на который переключается сервер.Протокол указывается в заголовке запроса Upgrade,полученном от клиента.Сервер включает в этот ответ заголовок ответа Upgrade,чтобы указать протокол,на который он переключился.

Код состояния 101 Switching protocols означает,что сервер понимает запрос поля заголовка Upgrade и указывает,на какой протокол он переключается.

Заголовок Sec-WebSocket-Protocol указывает один или несколько протоколов WebSocket,которые вы хотите использовать,в порядке предпочтения.Первый из них,который поддерживается сервером,будет выбран и возвращен сервером в заголовке Sec-WebSocket-Protocol,включенном в ответ.

I’m investigating some reported connectivity issues from users of our iOS app. The app is failing to load/refresh data for multiple minutes at a time, despite other apps, Safari, etc. working fine. We are investigating this at various layers in the pipeline (i.e. server-side, network), but I’m taking a look at what we know or can find out on the client.

I’m sure a lot of these kinds of issues get posted which end up being caused by transient network issues but I have a few specific questions about how I can find out more, and some questions around the behaviour of URLSession, so hopefully there are some people qualified to answer (BatEskimo-signal activated).

packet trace or gtfo 🙂

Unfortunately we’ve been unable to get a network/packet trace as this requires reproducing the issue locally which we haven’t been able to do.

Device logs show what look like typical timeout errors, occurring 60 seconds after initiating the requests:

Error Domain=NSURLErrorDomain Code=-1001 «The request timed out.» UserInfo={NSUnderlyingError=0x280764ae0 {Error Domain=kCFErrorDomainCFNetwork Code=-1001 «(null)» UserInfo={_kCFStreamErrorCodeKey=-2102, _kCFStreamErrorDomainKey=4}}, NSErrorFailingURLStringKey=https://REDACTED, NSErrorFailingURLKey=https://REDACTED, _kCFStreamErrorDomainKey=4, _kCFStreamErrorCodeKey=-2102, NSLocalizedDescription=The request timed out.})

The app is trying to send multiple requests over the minutes things are not working, and they are all failing with the same timeout error after 60 seconds. We’ve had users give up after 5 minutes because nothing is working. This is despite them having a good cellular or wifi connection and with other apps and Safari working. The users who have reported this so far are on iOS 12.

We are using a single URLSession for all our requests, created when the app starts. It’s pretty vanilla: the config is a

URLSessionConfiguration.default

but with a custom User-Agent to override the default one, added via

httpAdditionalHeaders

. All our requests hit the same https hostname, and they are all POSTs.

Now the interesting part is that we have a separate health check request we send occasionally which sends a POST to exactly the same end point as normal requests, and we are seeing this succeed during the periods when regular requests are timing out. One difference with the ping check is that we use a different URLSession instance on the client. This URLSession is also created on startup, and uses the same configuration. The only difference is a delegate that we use to do some cert pinning and report any certificate mismatch from what we expect.

We do have DNS load balancing on our end point, so different connections can end up hitting a different IP.

So there are a few initial thoughts and questions I have:

  • The failing requests could be going to a different IP than the successful health check ones, and a specific server could be bad in some way. Is there a way to log the resolved IP address that a particular URLSession task used, at the point of receiving the error? Googling and looking in the docs doesn’t show an obvious way to get this information. I imagine since URLSession can maintain a pool of connections to the same host, and there can be redirects during a request, that this is difficult to expose «nicely» via the API. We can obviously do this with local profiling but we would like to add telemetry to gather this data in the wild if possible.
  • Is it possible the «bad» URLSession is reusing a stale/dead persistent (keep-alive) connection, and everything on that socket is just timing out? What is the behaviour of connection reuse in these situations and under what circumstances will URLSession open a new connection? How long will it reuse a connection for? Will it continue reusing a connection even when requests are failing with timeout errors, even for multiple minutes?
  • Is there a way to log exactly where in the lifetime of the request the URLSession task got to before it timed out? i.e. did it even resolve DNS? Did it connect at all? Did it finish the TLS handshake? Did it send headers? Did it receive anything at all? There is the NSURLSessionTaskMetrics API but it doesn’t look like there’s an easy way to correlate an event from
    urlSession(_ session: URLSession, task: URLSessionTask, didFinishCollecting metrics: URLSessionTaskMetrics)

    to a particular data task / request, so we’d have to log everything (maybe checking if response is null to detect an incomplete load) and correlate later.

  • Some docs (e.g. «Technical Q&A QA1941» which I won’t link because this post will be put in a moderator queue) talk about some retry behaviour in URLSession for idempotent (e.g. GET) vs. non-idempotent (e.g. POST) requests, at least for «The network connection was lost» errors. Is there a similar or related behaviour for timeouts, or when a connection looks dead? If this is some transient network issue, would GET requests behave better in such situations when stuff is timing out? There are reasons we are using POST but it would be interesting to know more about how differently idempotent requests are treated

Thanks in advance

Replies

In situations like this, where users are reporting issues from the field but you can’t reproduce them, the weapon of choice is a sysdiagnose log. This includes a bunch of information from both CFNetwork and the underlying libnetcore (this is the internal name for the core implementation of the now-public Network framework).

You can learn more about sysdiagnose logs on our Bug Reporting > Profiles and Logs page.

Device logs show what look like typical timeout errors, occurring 60 seconds after initiating the requests:

FYI, error -2102 is an internal error

kCFStreamErrorRequestTimeout

, which isn’t any more informative.

Is there a way to log the resolved IP address that a particular URLSession task used, at the point of receiving the error?

No. IMO this would make a great addition to

NSURLSessionTaskTransactionMetrics

and if you agree I encourage you to file an
enhancement request explaining your rationale.

Please post your bug number, just for the record.

I think you’ll be able to get this information out of a sysdiagnose log, but I’d have to look at the log in depth to be sure.

Is it possible the «bad»

URLSession

is reusing a stale/dead persistent (keep-alive) connection, and everything on that socket is just timing out? What is the behaviour of connection reuse in these situations and under what circumstances will

URLSession

open a new connection?

Is this HTTP/1.1 or HTTP 2?

For HTTP 1.1 a timeout error on a specific request will close the connection used by that request because the nature of HTTP 1.1 means that it’s impossible to continue using that connection.

Is there a way to log exactly where in the lifetime of the request the

URLSession

task got to before it timed out?

I would’ve thought the task and transaction metrics would help here.

There is the

NSURLSessionTaskMetrics

API but it doesn’t look like there’s an easy way to correlate an event from

urlSession(_:task:didFinishCollecting:)

to a particular data task / request, so we’d have to log everything (maybe checking if response is null to detect an incomplete load) and correlate later.

I don’t understand this problem. That delegate callback gets the task via the

task

parameter. What more do you need for correlation purposes?

Is there a similar or related behaviour for timeouts, or when a connection looks dead?

I’m not sure. I will say that whatever retry logic available won’t kick in for POST requests. However, I don’t think that switching to GET makes sense. Something is blocking your entire session, so that completely new requests are also failing. In that situation it’s unlikely that an automatic retry would fair any better than the other requests you issue to your session.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

No. IMO this would make a great addition to

NSURLSessionTaskTransactionMetrics

and if you agree I encourage you to file an
enhancement request explaining your rationale.

Will do

Is this HTTP/1.1 or HTTP 2?

HTTP 2

I don’t understand this problem. That delegate callback gets the task via the

task

parameter. What more do you need for correlation purposes?

Sorry, disregard my previous comments, it looks like it has everything we need.

HTTP 2

OK, that opens up a bunch of possibilities, in that the HTTP 2 connection might be open but there’s something broken with its internal state machine (either on the client or the server). A CFNetwork diagnostic log is definitely the right next step here.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Thanks.

45304558 for enhancements to NSURLSessionTaskMetrics / NSURLSessionTaskTransactionMetrics

A couple more followup questions:

To get CFNetwork diagnostics information from devices in the wild, am I correct in thinking we need to first setenv(«CFNETWORK_DIAGNOSTICS», «3», 1); in main() as per https://developer.apple.com/library/archive/qa/qa1887/_index.html (and probably put this behind some kind of remote flag or Settings.app setting to avoid doing it for all our users), then have the appropriate users install the profile etc. from https://developer.apple.com/bug-reporting/profiles-and-logs/?name=sysdiagnose&platform=ios and capture a sysdiagnose and send it to us?

Without setting the env var will there be anything useful in a sysdiagnose, or is the CFNETWORK_DIAGNOSTICS where all/most of the interesting stuff comes from?

Also, is there a way to capture the CFNetwork diagnostic os_log output from within our app/process, so we could include it directly into our application logs which we can upload automatically? Or can it only be accessed via Analytics->… / Console.app?

Also, is there a way to capture the CFNetwork diagnostic os_log output from within our app/process …

No. There are numerous difficulties in making that work [1] but I realise that it’d be a super-useful feature so don’t let that stop you from filing an enhancement request describing your requirements

Please post your bug number, just for the record.

To get CFNetwork diagnostics information from devices in the wild, am I correct in thinking we need to first

setenv("CFNETWORK_DIAGNOSTICS", "3", 1);

in

main()

Correct.

and probably put this behind some kind of remote flag or Settings.app setting to avoid doing it for all our users

If you put this in a production build, make sure that the UI informs the user of the privacy risks involved in enabling it.

then have the appropriate users install the profile

That step is not necessary.

capture a sysdiagnose and send it to us?

Yes.

Without setting the env var will there be anything useful in a sysdiagnose … ?

Yes, although it’s hard to say whether that will help you debug this question. This environment variable enables CFNetwork diagnostics, which lets you see what’s going on internal to CFNetwork. If you don’t set it then you still get a bunch of logging. On the networking front that includes extensive DNS logging from

mDNSResponder

and a bunch of lower-level network logging from

libnetcore

(the private library used by CFNetwork for its on-the-wire activities; this is the same library that backs the new Network framework). That might help you understand this problem, or it might not. It kinda depends on what the actual problem is, and we don’t know that yet.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

[1] One major problem is that we can’t give you all log messages on the system because of privacy concerns, but a lot of the value in OSLog is that it lets you track activity as it crosses processes. For an example close to your heart, much of the internals of CFNetwork are implemented in separate daemons (DNS is done via

mDNSResponder

, authentication UI via

CFNetworkAgent

, cookies and caches via

nsurlstoraged

, background sessions via

nsurlsessiond

, and so on).

I have similar strange periodic timeouts in my app as Userbla

But what is different:

— I use NSURLSession’s shared instance which means no custom delegate code is involved.

— HTTP/1.1

— Timeout happens for a specific domain/ip address

— App restart fixes the issue

— I am able to reproduce the issue locally. Although it is hard and may take up to 1-2 hours sometimes

— Captured packet trace and network logs and opened a bug 48359240

— Requests are sent OK using the same code but if I create a new instance of NSURLSession

— The issue happens when the app was in the background for more than 10-15 minutes(?)
— Can’t reproduce the issue in a separate sample project, so not sure what exactly causes the issue

Hi sergeyne,

We’ve faced with a similar issue, had your bug is closed with some resolution?

Use case:

  • Make a switch between wifi and 3G/4G;
  • Moving to the background and foreground;

At some point, the user sees time out error for all requests. Only restart of the app helps.

eskimo,

Using «setenv(«CFNETWORK_DIAGNOSTICS», «3», 1);»

I’ve gathered the following.

default 19:54:56.119246 +0300 **** CFNetwork Diagnostics [3:37959] 18:54:56.116 {
 Protocol Enqueue: request GET https://***** HTTP/1.1
          Request:  {url = https://****, cs = 0x0}
          Message: GET https://**** HTTP/1.1
           Accept: application/json
     Content-Type: application/json
      X-Client-Id: 2.3.41 (18460)||Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148
  header: ***
  Accept-Language: en-us
header: ***
  Accept-Encoding: br, gzip, deflate
     header: ***
} [3:37959]
default 19:54:56.274545 +0300 bluetoothd Matched UUID *** for device ""
default 19:54:56.392140 +0300 *** TIC TCP Conn Cancel [518:0x282f57780]
default 19:54:56.392264 +0300 *** [C518 ***:443 tcp, url hash: e37a5a66, tls] cancel
default 19:54:56.392425 +0300 *** [C518 ***:443 tcp, url hash: e37a5a66, tls] cancelled

And then.

default 19:55:06.535110 +0300 *** CFNetwork Diagnostics [3:37960] 18:55:06.533 {
        Did Timeout: (null)
             Loader:  {url = https://***, cs = 0x0}
   Timeout Interval: 60.000 seconds
init to origin load: 0.000351071s
         total time: 60.1877s
        total bytes: 0
} [3:37960]

Do you have any clues about what we should look for do understand the reason for such behavior?
Thanks in advance.

Ok, I lost a lot of time investigeting similar issue.

In my case the problem was strange (bad?) firewall on the server. It was banning device when there was many (not so many) requests in short period of time.

I believe you can do easy test if you are facing similar issue.

1. Send a lot of (depends of firewall settings) requests in loop (let’s say 50 in 1 second).

2. Close/Kill app (this will close connections to server)

3. (OPTIONAL) Wait a while (lets say 60 seconds)

4. Start app again and try send request

If you now got timeout for all next requests, you probably have same issue and you should talk with sever guys.

PS: if you don’t have access to server you can give user info that he should restart wifi on device to quit that timeout loop. It could be last resort in some cases.

I see this issue in 14.4 devices.

Hello,

Did you manage to solve this issue?

I am getting the following error only from Apple Review, never while testing on real devices myself (iOS 14.6)

Error Domain=NSURLErrorDomain Code=-1001 «The request timed out.» UserInfo={_kCFStreamErrorCodeKey=60, NSUnderlyingError=0x282a3b600 {Error Domain=kCFErrorDomainCFNetwork Code=-1001 «(null)» UserInfo={_kCFStreamErrorCodeKey=60, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask

When tried to access a URL link in iPhone 13( iOS 15.0 ) browser, getting “Error loading page, Domain NSURLErrorDomain, Error Code 1001, Description: The request timed out”. We are loading the same URL in webview in our iOS app. It is not working in the app also. Giving the same error

Using high speed Wifi and Cellular data. No connectivity issues. Verified speed of connectivity in this phone. Not getting this issue in any other iPhones/ iPads & Android mobiles. There the URL is loading fine within seconds

Same URL is accessible in Laptop and desktop computers in same network connectivity

Will there be any settings to edit or device specific issues that cause this?

Posting in case this helps anyone else. We were getting a lot of these timeouts after loading a bunch of image URLs. Our app would load ~100 images and then all future image requests would time out.

After lots of digging the fix was server side: we disabled the HTTP/3 (with QUIC) setting on our Cloudflare instance.

My issue causing -1001 timeout error was URLSessionConfiguration custom configuration. Once I set a default URL session configuration -1001 timeout errors disappeared.

**Notice, it did not cause the issue on a real device, only on iOS simulator. **

I am using the following code to post an image to my server.

@IBAction func postButtonPressed(sender: UIButton) {
    let task = NSURLSession.sharedSession().dataTaskWithRequest(createRequest("http://xx.xx.xxx.xxx/xxxx/"), completionHandler: {
        data, response, error in
        println(NSString(data: data, encoding: NSUTF8StringEncoding))
    })
    task.resume()
}

where createRequest() creates the required NSURLRequest object.

This works fine when I use a simulator. The problem is that I am getting the following error when I run my app on an iPhone.

Error Domain=NSURLErrorDomain Code=-1001 "The operation couldn’t be completed. (NSURLErrorDomain error -1001.)" UserInfo=0x155e71f0 {NSErrorFailingURLKey=http://xx.xxx.xxx.xxx/xxxx/, NSErrorFailingURLStringKey=http://54.148.156.117/query/, NSUnderlyingError=0x155674d0 "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1001.)"}

I have learned that this error is a timeout error. Restarting the app or phone didn’t helped. Moreover I have tried posting an image to my server from a web browser and it worked with no problem.

What might be causing this timeout error?

EDIT: When I monitor my network activity, I realized the app sends 10 MB data even though the image that I am sending is 0.1 MB.

HRESULT: 0x2
HTTP status: 500
HTTP subStatus: 1001
HTTP reason: Internal Server Error

I get the following error whenever I launch my application for the first time. This is fixed by just refreshing the browser but I would love to know whats causing it. I followed the initial troubleshooting advice and ran the etw.bat for the trace. I looked over the logs and didn’t see any errors. Not sure what I should be even looking for there.

My environment is as follows.
IIS 7.5 windows server 2008 R2
IISNODE 32 bit how to find the version ?
Load balanced with another server with the same setup.
webconfig

<!— Virtual Directory Setup
assign virtualDirPath below a value like ‘/{path}’

        Add below to your app code and then prepend routes with virtualDirPath
        var virtualDirPath = process.env.virtualDirPath || ''; -->
    <add key="virtualDirPath" value="/claimcheck" />
</appSettings>
<system.webServer>
    <!-- mimeMap enables IIS to serve particular file types as specified by fileExtension. -->
    <staticContent>
        <!--<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />-->
    </staticContent>
    <modules runAllManagedModulesForAllRequests="false" />

    <iisnode node_env="build" nodeProcessCountPerApplication="1" maxConcurrentRequestsPerProcess="1024" maxNamedPipeConnectionRetry="100" namedPipeConnectionRetryDelay="250" maxNamedPipeConnectionPoolSize="512" maxNamedPipePooledConnectionAge="30000" asyncCompletionThreadCount="0" initialRequestBufferSize="4096" maxRequestBufferSize="65536" uncFileChangesPollingInterval="5000" gracefulShutdownTimeout="60000" loggingEnabled="true" logDirectory="iisnode" debuggingEnabled="true" debugHeaderEnabled="false" debuggerPortRange="5058-6058" debuggerPathSegment="debug" maxLogFileSizeInKB="128" maxTotalLogFileSizeInKB="1024" maxLogFiles="20" devErrorsEnabled="true" flushResponse="false" enableXFF="false" promoteServerVars="LOGON_USER" configOverrides="iisnode.yml" watchedFiles="web.config;*.js" nodeProcessCommandLine="C:Program Filesnodejsnode.exe" />

    <handlers>
        <!-- Handler for non Socket.io Apps -->
        <add name="iisnode" path="iisnode.js" verb="*" modules="iisnode" />
        <!-- Handler for Socket.io Apps -->
        <!-- <add name="iisnode-socket.io" path="app.js" verb="*" modules="iisnode" /> -->
    </handlers>
    <rewrite>
        <rules>
            <!-- Don't interfere with requests for node-inspector debugging -->
            <rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
                <match url="^app.js/debug[/]?" />
            </rule>

            <!-- First we consider whether the incoming URL matches a physical file in the /public folder -->
            <rule name="StaticContent" patternSyntax="Wildcard">
                <action type="Rewrite" url="public/{R:0}" logRewrittenUrl="true" />
                <conditions>
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                </conditions>
                <match url="*.*" />
            </rule>
            <!-- All other URLs are mapped to the Node.js application entry point -->
            <rule name="DynamicContent">
                <conditions>
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True" />
                </conditions>
                <action type="Rewrite" url="iisnode.js" />
            </rule>
            <rule name="SocketIO" patternSyntax="ECMAScript">
                <match url="socket.io.+" />
                <action type="Rewrite" url="iisnode.js" />
            </rule>
        </rules>
    </rewrite>
    <directoryBrowse enabled="false" />

</system.webServer>


Я пишу код, связанный с StoreKit, и я получаю некоторые довольно тревожные коды ошибок, когда я пытаюсь добавить покупку в очередь.

до сих пор я испытывал коды ошибок -1003 и -1004, и я не могу найти ничего об этих кодах в интернете.

запуск запроса продукта возвращает действительные номера продуктов, поэтому я не знаю, почему звонит в [[SKPaymentQueue defaultQueue] addPayment:aPayment]; не удалось бы с этой недокументированной проблемой.

один и тот же код работает без ошибок на одном устройство, но не на другом.

вопросы, которые у меня есть, пока остаются без ответа:

Что означают эти коды?
Как я могу смягчить эту проблему?
Почему они происходят для попыток покупки, а не для запросов продукта?

Устранение неполадок, которые я сделал, включает в себя регенерацию сертификата подписи и профиля подготовки, изменение сетей WiFi, очистку и сборку и переустановку всего связанного программного обеспечения и компонентов, и ни одна из этих вещей отдельно или вместе помогли решить проблему.

EDIT:

нашел дискуссию об этом на форумах Apple dev, но никто из Apple не ответил: https://devforums.apple.com/thread/107121?tstart=75 (для просмотра требуется учетная запись разработчика iOS)

EDIT:

сегодня я был поражен кодом ошибки -1001, чтобы добавить к этому списку необъяснимых и прерывистых проблем. До сих пор нет отчетности от Apple, что я могу находить.

EDIT:

У меня есть подозрение, что эти коды ошибок генерируются случайным образом и действительно указывают только на то, что песочница не работает. Кто-нибудь еще испытывает эту проблему?


658  


6  

6 ответов:

все коды ошибок находятся в разделе» Ссылки на коды ошибок CFNetwork » в документации (ссылке)

небольшое извлечение для ошибок CFURL и CFURLConnection:

  kCFURLErrorUnknown   = -998,
  kCFURLErrorCancelled = -999,
  kCFURLErrorBadURL    = -1000,
  kCFURLErrorTimedOut  = -1001,
  kCFURLErrorUnsupportedURL = -1002,
  kCFURLErrorCannotFindHost = -1003,
  kCFURLErrorCannotConnectToHost    = -1004,
  kCFURLErrorNetworkConnectionLost  = -1005,
  kCFURLErrorDNSLookupFailed        = -1006,
  kCFURLErrorHTTPTooManyRedirects   = -1007,
  kCFURLErrorResourceUnavailable    = -1008,
  kCFURLErrorNotConnectedToInternet = -1009,
  kCFURLErrorRedirectToNonExistentLocation = -1010,
  kCFURLErrorBadServerResponse             = -1011,
  kCFURLErrorUserCancelledAuthentication   = -1012,
  kCFURLErrorUserAuthenticationRequired    = -1013,
  kCFURLErrorZeroByteResource        = -1014,
  kCFURLErrorCannotDecodeRawData     = -1015,
  kCFURLErrorCannotDecodeContentData = -1016,
  kCFURLErrorCannotParseResponse     = -1017,
  kCFURLErrorInternationalRoamingOff = -1018,
  kCFURLErrorCallIsActive               = -1019,
  kCFURLErrorDataNotAllowed             = -1020,
  kCFURLErrorRequestBodyStreamExhausted = -1021,
  kCFURLErrorFileDoesNotExist           = -1100,
  kCFURLErrorFileIsDirectory            = -1101,
  kCFURLErrorNoPermissionsToReadFile    = -1102,
  kCFURLErrorDataLengthExceedsMaximum   = -1103,

У меня есть подобные проблемы, в моем случае, похоже, связанные с сетевым подключением:

Error Domain=Nsurlerrordomain Code=-1001 » истекло время ожидания запроса.»

вещи для проверки:

  • есть ли вероятность, что ваш сервер не сможет ответить в течение некоторого срока? Как 60 секунд или 4 минуты?
  • есть ли возможность, что ваше устройство переключает сети (WiFi, 3G, VPN)?
  • кто-то может (клиент против сервера) ждать аутентификации?

извините, нет идей, как исправить. Просто отладка это, пытаясь выяснить, в чем проблема (-1021, -1001, -1009)

обновление: поиск Google был очень любезен, чтобы найти это:

  • -1001 тайм-аут-это заняло больше времени, чем тайм-аут, который был выделен.
  • -1003 CannotFindHost-хост не может быть найден.
  • -1004 CannotConnectToHost-хост не дали бы нам установить связь.

посмотреть NSURLError.h определить

NSURLErrorUnknown =             -1,
NSURLErrorCancelled =           -999,
NSURLErrorBadURL =              -1000,
NSURLErrorTimedOut =            -1001,
NSURLErrorUnsupportedURL =          -1002,
NSURLErrorCannotFindHost =          -1003,
NSURLErrorCannotConnectToHost =         -1004,
NSURLErrorNetworkConnectionLost =       -1005,
NSURLErrorDNSLookupFailed =         -1006,
NSURLErrorHTTPTooManyRedirects =        -1007,
NSURLErrorResourceUnavailable =         -1008,
NSURLErrorNotConnectedToInternet =      -1009,
NSURLErrorRedirectToNonExistentLocation =   -1010,
NSURLErrorBadServerResponse =       -1011,
NSURLErrorUserCancelledAuthentication =     -1012,
NSURLErrorUserAuthenticationRequired =  -1013,
NSURLErrorZeroByteResource =        -1014,
NSURLErrorCannotDecodeRawData =             -1015,
NSURLErrorCannotDecodeContentData =         -1016,
NSURLErrorCannotParseResponse =             -1017,
NSURLErrorAppTransportSecurityRequiresSecureConnection NS_ENUM_AVAILABLE(10_11, 9_0) = -1022,
NSURLErrorFileDoesNotExist =        -1100,
NSURLErrorFileIsDirectory =         -1101,
NSURLErrorNoPermissionsToReadFile =     -1102,
NSURLErrorDataLengthExceedsMaximum NS_ENUM_AVAILABLE(10_5, 2_0) =   -1103,

// SSL errors
NSURLErrorSecureConnectionFailed =      -1200,
NSURLErrorServerCertificateHasBadDate =     -1201,
NSURLErrorServerCertificateUntrusted =  -1202,
NSURLErrorServerCertificateHasUnknownRoot = -1203,
NSURLErrorServerCertificateNotYetValid =    -1204,
NSURLErrorClientCertificateRejected =   -1205,
NSURLErrorClientCertificateRequired =   -1206,
NSURLErrorCannotLoadFromNetwork =       -2000,

// Download and file I/O errors
NSURLErrorCannotCreateFile =        -3000,
NSURLErrorCannotOpenFile =          -3001,
NSURLErrorCannotCloseFile =         -3002,
NSURLErrorCannotWriteToFile =       -3003,
NSURLErrorCannotRemoveFile =        -3004,
NSURLErrorCannotMoveFile =          -3005,
NSURLErrorDownloadDecodingFailedMidStream = -3006,
NSURLErrorDownloadDecodingFailedToComplete =-3007,

NSURLErrorInternationalRoamingOff NS_ENUM_AVAILABLE(10_7, 3_0) =         -1018,
NSURLErrorCallIsActive NS_ENUM_AVAILABLE(10_7, 3_0) =                    -1019,
NSURLErrorDataNotAllowed NS_ENUM_AVAILABLE(10_7, 3_0) =                  -1020,
NSURLErrorRequestBodyStreamExhausted NS_ENUM_AVAILABLE(10_7, 3_0) =      -1021,

NSURLErrorBackgroundSessionRequiresSharedContainer NS_ENUM_AVAILABLE(10_10, 8_0) = -995,
NSURLErrorBackgroundSessionInUseByAnotherProcess NS_ENUM_AVAILABLE(10_10, 8_0) = -996,
NSURLErrorBackgroundSessionWasDisconnected NS_ENUM_AVAILABLE(10_10, 8_0)= -997,

Я использую следующий метод в моем проекте

-(NSArray*)networkErrorCodes
{
    static NSArray *codesArray;
    if (![codesArray count]){
        @synchronized(self){
            const int codes[] = {
                //kCFURLErrorUnknown,     //-998
                //kCFURLErrorCancelled,   //-999
                //kCFURLErrorBadURL,      //-1000
                //kCFURLErrorTimedOut,    //-1001
                //kCFURLErrorUnsupportedURL, //-1002
                //kCFURLErrorCannotFindHost, //-1003
                kCFURLErrorCannotConnectToHost,     //-1004
                kCFURLErrorNetworkConnectionLost,   //-1005
                kCFURLErrorDNSLookupFailed,         //-1006
                //kCFURLErrorHTTPTooManyRedirects,    //-1007
                kCFURLErrorResourceUnavailable,     //-1008
                kCFURLErrorNotConnectedToInternet,  //-1009
                //kCFURLErrorRedirectToNonExistentLocation,   //-1010
                kCFURLErrorBadServerResponse,               //-1011
                //kCFURLErrorUserCancelledAuthentication,     //-1012
                //kCFURLErrorUserAuthenticationRequired,      //-1013
                //kCFURLErrorZeroByteResource,        //-1014
                //kCFURLErrorCannotDecodeRawData,     //-1015
                //kCFURLErrorCannotDecodeContentData, //-1016
                //kCFURLErrorCannotParseResponse,     //-1017
                kCFURLErrorInternationalRoamingOff, //-1018
                kCFURLErrorCallIsActive,                //-1019
                //kCFURLErrorDataNotAllowed,              //-1020
                //kCFURLErrorRequestBodyStreamExhausted,  //-1021
                kCFURLErrorFileDoesNotExist,            //-1100
                //kCFURLErrorFileIsDirectory,             //-1101
                kCFURLErrorNoPermissionsToReadFile,     //-1102
                //kCFURLErrorDataLengthExceedsMaximum,     //-1103
            };
            int size = sizeof(codes)/sizeof(int);
            NSMutableArray *array = [[NSMutableArray alloc] init];
            for (int i=0;i<size;++i){
                [array addObject:[NSNumber numberWithInt:codes[i]]];
            }
            codesArray = [array copy];
        }
    }
    return codesArray;
}

тогда я просто проверить код ошибки и показать предупреждение, если он находится в списке

if ([[self networkErrorCodes] containsObject:[NSNumber
numberWithInt:[error code]]]){ 
// Fire Alert View Here
}

но, как вы можете видеть, я прокомментировал коды, которые я думаю, не соответствует моему определению нет интернета. Например, код -1012 (ошибка аутентификации.)
Вы можете редактировать список, как вам нравится.

в моем проекте я использую его на имени пользователя/пароля пользователя. И на мой взгляд (физические) ошибки сетевого подключения могут быть единственная причина, чтобы показать вид оповещения в вашем сетевом приложении. В любом другом случае (например, неверная пара имя пользователя/пароль) я предпочитаю делать некоторые пользовательские дружественные анимации, или просто повторить неудачную попытку снова без какого-либо внимания пользователя. Особенно если пользователь явно не инициировал сетевой вызов.

С уважением к martinezdelariva для ссылки на документацию.

Я нашел новый код ошибки, которая не описана выше:
CFNetworkErrorCode -1022

Error Domain=NSURLErrorDomain Code=-1022 "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection."

Answer

Error codes 1000 / 1001 found in the detailed HTTP status code results (hcs.csv) are a place holder for protocal errors and do not represent valid HTTP status codes from a server.

An example of errors that would incriment these status code bins are ‘http incomplete transactions’ and ‘http bad content length’ found in the summary and realtime .csv result files indicating network stress such as packet loss.

Version
1.0

Publish Date
2012-02-29

Categories

Product : Avalanche,App Testing,HTTP

Related Articles

Понравилась статья? Поделить с друзьями:
  • Ошибка 10006 diskmaker
  • Ошибка 10005 xmeye как исправить ошибку
  • Ошибка 10004 госуслуги
  • Ошибка 10004 siemens nx
  • Ошибка 10004 shadow fight 3