I'm using XMPP & OpenFire for my iOS project. The internet connection is stable.
Everything is fine on the first sign in. However from the second time on (sign out then sign in again), it rarely works.
I oftens get readTimeoutError after 10-15s :
Error Domain=GCDAsyncSocketErrorDomain Code=4 "Read operation timed out" UserInfo=0xa8db6a0 {NSLocalizedDescription=Read operation timed out}
Because of that, the app doesn't jump to - (void)xmppStreamDidConnect:(XMPPStream *)sender, thus i'm not connected with OpenFire.
I've spent the whole day on this issue but still can't find the solution. Can anyone help me ?
Found the problems you are facing. Please close your sockets correctly, it will be fine.
Related
I have piece of code that fires couple of requests using NSURLsession and sometimes I get the below message on debugger of xcode
received XPC error Connection interrupted for message type 3
kCFNetworkAgentXPCMessageTypePACQuery
I am thinking what causes this issue ?
Is it something to be worried about ?
Googling doesn't help much
Maybe it is caused by Network Proxy like VPN/VPS ,close them and Command R again.
I got exactly the same error.
During the first attempt I had the VPN on. After turning it off the message did not appear.
[carc] CAReportingClient.mm:320:-[CAReportingClient sendMessage:category:type:reporters:]_block_invoke: The operation couldn’t be completed. No valid RTCReporting and the session was started
i have the same problem with using google stun:stun:stun.l.google.com:19302
i think the problem is caused by the stun/turn server.
i solve and test it successfully with applying a free turn server in http://numb.viagenie.ca/cgi-bin/numbacct
and in swift i just add the
RTCIceServer(urlStrings: ["turn:numb.viagenie.ca:3478"], username: "YourUserName", credential: "yourPassword")
into iceServers list of webrtc,
this works for me, at least prove my swift side is correct(i am iOS developer), all the rest is the turn/stun server side.
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];
Suddenly in my project,I keep on getting error as below which works well before.
error:
{
NSLocalizedDescription = "The requested operation has been canceled or disabled by the user.";
}, 2
I can see the GameCenter login window several days ago,but now it doesn't show again.
After search with error info above in statckoverflow ,I found this has happened with ios7。3 times after dismiss of GameCenter login window,it never shows again.I reset the hardware,then it works。
It seems the same problem in ios8.1 with in ios7.Will it be solved in later version all it is the strategy that never changed,means it does not fixed in ios7.1 ?
I suppose that if you switch to the Game Center app and log in there all will be good. After a third unsuccessful login attempt in GKGameCenterViewController (i.e. your app) that is normally required.
I've got NSURLConnection with timeout = 30s which is uploading an image on server.
If connection is horrible and call delegate method didFailWithError: then i need to cancel current connection.
But if i just call the [myConnection cancel] connection will still alive but will not call delegates methods (apple docs say it - NSURLConnection cancel method). And i want to abort connection but not only remove delegate methods. How i can do what?
upd:
My problem is if connection is fails by timeout - in business logic i must recreate connection with similar request. If i have got horrible connection for 1 min and after that connection will be good - server will get a lot of (about 3 times retry count) photos. But first 2 connections is canceled. –
At the moment i make "dirty hack" like "if it's photo uploading request" - do not retry recreate connection.
I do a ton of network stuff and don't recall a scenario where everything was successfully received but the iOS app timed out. I'm trying to grok the scenario you describe, where you're seeing this happen a lot and I'm not seeing how that would happen. We might need to see some of your code.
Regardless, when you cancel a NSURLConnection, it not only stops the delegate methods from being called, but it stops the upload, too. I just did a test:
I attempting to upload a 20mb file (non-chunked request);
At the 1mb mark (as identified by didSendBodyData), I canceled the connection (by calling [connection cancel]);
I immediately stopped receiving any delegate messages at that point;
Looking at Charles, I'm only seeing 1.3mb of data in the hex log of the request. When I look at the "Network" tab of the Mac OS "Activity Monitor" and looking at by "Sent Bytes", it's at 2.1mb uploaded.
So canceling a connection will stop further data from being sent. Perhaps if there is some transmission in progress that still gets out (that's the asynchronous world we live it), but the it's not true to conclude that canceled connections will routinely send their full HTTP request. There must be something about the nature of the timeout that is unique to your environment.
In terms of your immediate problem, I might suggest that when uploading a file that the iOS app assign some unique identifier to the upload so that the server code can immediately recognize duplicate requests and handle them appropriately. But the question is why you are seeing so many time-outs and notably ones where the request appears to be successfully received in toto, but the response is not. That's very curious.
You cannot forcefully abort an ongoing connection.
In case if connection is not yet started cancel and unscheduleFromRunLoop for the NSURLConnection will work.
Try with following step
[myConnection cancel];
myConnection = nil;
Might be helpful in your case and If this step is not working then also try with myConnection.delegate = nil;