Simulate URL Loading System Error Codes in iOS - ios

Users of an app I took over recently are reporting network error alerts like those:
Network error (-1009)
Network error (-1001)
Network error (-1005)
Network error (2)
(Fejl is Danish for Error)
The error are: NSURLErrorTimedOut, NSURLErrorNetworkConnectionLost, NSURLErrorNotConnectedToInternet, so mostly about bad/lost connection to the server.
AFNetworking 3.0 is used.
In the request headers we find Connection: close and the timeout is set to 15 seconds request.timeoutInterval = 30
First, I couldn't find showing an alert anywhere in the source code, so I would like to know if the displayed alerts on network errors are handled by iOS?
Then, I am looking for a way to simulate those errors. I tried with the Network Link Conditioner on a device but didn't get any of those errors.
The errors and their respective error codes are listed here:
https://developer.apple.com/reference/foundation/1508628-url_loading_system_error_codes?language=objc

Related

iPhone 13( iOS 15.0 ) Error loading page, Domain NSURLErrorDomain, Error Code 1001, Description: The request timed out

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. 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?

how to download webgl unity game to use offline

I want to download some game(for using offline and for keep it in archive) which built with Unity in WebGL format. I tried downloading it with wget and HTTrack,but when I running it on local web server I only get errors like this: "An error occurred running Unity content".
In Chrome Developer Console I see this:
Failed to load resource: the server responded with a status of 404 (Not Found) UnityLoader.js:3 Invoking error handler due to Script error. index.html:1 Uncaught SyntaxError: Unexpected token < in JSON at position 0 at JSON.parse () at XMLHttpRequest.t.onload (UnityLoader.js:4) index.html:1 Unchecked runtime.lastError: The message port closed before a response was received
Is it possible to download Unity WebGL game? If yes, how?
I worried that if this is not possible, that can lead to losing a lot of content,because of sites sometimes went down.

iOS Not playing some Videos - CoreMediaErrorDomain Code=-12939

I am using CTVideoView to playback videos inside a UITableView in iOS. As of late this was working fine, but for some reason, it seems as though the something has gone astray.
About 10% of the videos will play in the table, but many will simply just fail to play. The error occurs when iOS is trying to download the video as can be seen by the error messages below. For some reason, the error message is different in iOS 10 & 11 but the code is the same.
Based on iOS 10's message one would believe that the network is not available, but if I point my safari/chrome browser on the same iOS device it plays the video just fine.
As for the iOS 11 message, I have no idea where to even start as it the first time I've seen this message.
Any help at all would be much appreciated in resolving this.
iOS 10 Error Message
FAILED TO PREPARE VIDEO WITH ERROR: Error Domain=NSURLErrorDomain
Code=-1 "unknown error" UserInfo={NSLocalizedDescription=unknown
error,
NSErrorFailingURLStringKey=URLOBSCUREDFORPRIVACY,
NSErrorFailingURLKey=URLOBSCUREDFORPRIVACY,
NSURL=URLOBSCUREDFORPRIVACY,
NSUnderlyingError=0x17044bd00 {Error Domain=CoreMediaErrorDomain
Code=-12939 "CFNetwork error unavailable"
UserInfo={NSDescription=CFNetwork error unavailable,
NSURL=URLOBSCUREDFORPRIVACY}}}
iOS 11 Error Message
FAILED TO PREPARE VIDEO WITH ERROR: Error Domain=NSURLErrorDomain
Code=-1 "unknown error" UserInfo={NSUnderlyingError=0x1c08483d0 {Error
Domain=CoreMediaErrorDomain Code=-12939 "content range mismatch -
should be start 0 length 1247166 is start 0 length 1048575"
UserInfo={NSDescription=content range mismatch - should be start 0
length 1247166 is start 0 length 1048575,
NSURL=URLOBSCUREDFORPRIVACY}},
NSErrorFailingURLStringKey=URLOBSCUREDFORPRIVACY,
NSErrorFailingURLKey=URLOBSCUREDFORPRIVACY,
NSURL=URLOBSCUREDFORPRIVACY,
NSLocalizedDescription=unknown error}
Update (Possible Clue)
So after some testing I've narrowed it down to videos longer than or equal to 10 seconds. In all other circumstances the video will play.
I have resolved the issue. The issue was with ParseServer and the fact that it could not stream videos to iOS as it does not come out of the box with byte-range headers configured.
The solution was to implement the GridStoreAdapter into the server and from there migrate file storage to S3 or GCS (depending on your preference). This will need to be done alongside the respective adapter for your service.
Once that was done, the app started behaving correctly again.

iOS/RestKit - request timed out

My iOS app use RestKit framework for implementing RESTful web services client.
Sometimes, I have a problem when I call my server from my application.
The request is not sent and it fails at the end of the expiration with this error:
Error Domain=NSURLErrorDomain Code=-1001 "The request timed out."
At the first openning, it is impossible to reproduce this.
The problem occurs when the application is put into the background and it restarts 10 minutes later or more (it does not produce every time). At this point, there is no server side call .
Then, the only way to solve this problem is to force-quit the application.
We checked there is no error of url, of header, etc ...
HELP ME :'(
Try to set time interval like
[manager.requestSerializer setTimeoutInterval:yourTimeInterval];

Apple Push - didReceiveIncomingPushWithPayload not called - instead error: Failed sending message to client

I have an app that uses pushkit (voip push).
Most of the time the pushes get through. But when there is a lot of traffic, the pushes don't get through to the app.
I am in a state where I can somehow reproduce the error.
I used the extended logging from here:
https://developer.apple.com/library/ios/technotes/tn2265/_index.html
And I found this to examine the logging:
http://iosdevelopertips.com/core-services/debug-failed-push-messages-by-logging-apsd-process.html
Still, I got two different cases, where I just don't get further:
- In the apsd-log I get
Received message for enabled topic ...
and in the app the didReceiveIncomingPushWithPayload is not called. I produce a log entry right at the start of the function and do nothing special that could prevent the function from finishing.
- In the apsd-log I get
Stream error occurred ...
but do not find any other error messages, why this error occurs.
The Port seems ok
After restarting the app the pushes get through again.
EDIT:
The relevant error in the log file seems to be:
apsd[82]: Failed sending message to client: com.apple.telephonyutilities.callservicesdaemon.voip.push.development
There seems to be two types of cases: In some cases, which are reproducable with large traffic, reregistering the pushkit seems to help.
In other cases, which occur random, it simply does not. Restarting the app does not help here either.
All helps so far, is restarting the iphone.
EDIT:
I am still struggling with this problem.
In some cases I get a memory warning before the push seems to fail.
In other cases I get a xpc communication warning like this:
SpringBoard[43] <Warning>: Communications error: <OS_xpc_error: <error: 0x3b7ef614> { count = 1, contents =
"XPCErrorDescription" => <string: 0x3b7ef86c> { length = 22, contents = "Connection interrupted" }
}>
In some cases none of the above happens, but push still does not work.
EDIT:
In developer archive I found this very interesting thread, but still no answer:
https://devforums.apple.com/thread/257354?start=50&tstart=0
Does anybody know if there is a connection between xpc and push?
And is there a way to detect a xpc error in code?

Resources