nsurlconnection

(Asynchronous) NSURLConnection: what's going on underneath?

早过忘川 提交于 2019-12-05 06:14:55
问题 I understand that it must be taking care of the ugliness of launching a thread to make the network request, then probably calling performSelectorOnMainThread: with my delegate method. I know how to use it when doing iOS programming, and it works great. However, I'd like to know how I would make it work doing in the context of (for example) a command line utility, where there is no UIApplication with the event processing etc. I've tried it, and it seems that the program exits as soon as the

Iphone SOAP request step by step tutorial

与世无争的帅哥 提交于 2019-12-05 05:10:06
问题 I've been looking here for some answers to this question and have found some resources but not really found the "spot on" tutorial. So i would be grateful for any posts of tutorials on howto get SOAP working in an iphone app. I have seen that it can be done using NSURLconnection. But as I am pretty new to Objective C programming i would have wanted to see a step by step tutorial. Like an SOAP "Hello World" if you would like. 回答1: Also, Alexander Griekspoor wrote a nice hands-on, two-part

How can I receive data from URL on iPhone?

隐身守侯 提交于 2019-12-05 02:53:16
问题 I'm using the code from Apple's Document to do some HTTP communication. I can connect to the URL successfully, but I failed to receive the data from my server. // create the request NSURLRequest *theRequest=[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://..."] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0]; // create the connection with the request // and start loading the data NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:theRequest

HTTP Status Code 411 - Length Required

梦想的初衷 提交于 2019-12-05 01:20:00
I try to get data from server. I use NSURLConnectionDelegate, NSURLConnectionDataDelegate. There is code (Objective - C). -(void)sendRequest { NSURL* url = [[NSURL alloc] initWithString:@"http://SomeServer"]; NSMutableURLRequest* request = [[NSMutableURLRequest alloc] init]; NSString* reqBody = [NSString stringWithFormat:@"<tag>Content</tag>"]; NSData* reqData = [reqBody dataUsingEncoding:NSUTF8StringEncoding]; NSInputStream* stream = [NSInputStream inputStreamWithData:reqData]; [request setURL:url]; [request setHTTPBodyStream:stream]; [request setHTTPMethod:@"POST"]; self.wpData = [

Why is my server's wildcard SSL certificate being rejected?

隐身守侯 提交于 2019-12-05 01:00:52
问题 I am using an NSURLConnection to connect to a server with a wildcard TLS certificate (like "*.domain.com"), and when I call SecTrustEvaluate in my NSURLConnectionDelegate 's -connection:willSendRequestForAuthenticationChallenge: method, the certificate is rejected as invalid. Another server that has a fully-specified TLS certificate (like "server2.domain.com") is accepted. Both certificates are issued by the same CA, and I have added the CA certificate to my device's trusted certificate list.

NSURLConnection sendSynchronousRequest - background to foreground

梦想与她 提交于 2019-12-04 23:22:05
问题 I m using sendSynchronousRequest to get the data from the server. I know that synchronous will wait until the data received for that request. But the problem comes when user by mistake enters some non-existing url and than tries to get response. In this case, if user goes in to background and than comes into foreground it shows only black screen. It only shows status bar. Also its not showing any background application. I have to press Home button to come out of my application. On simulator,

Why iOS8 SSL requests fail intermittently after migration from iOS7? [closed]

喜你入骨 提交于 2019-12-04 22:56:07
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . I have an iOS app, which works fine on iOS7. Now we are testing it on iOS8, and when running under iOS8, we have SSL issues. Some (but not all) SSL requests fail. All requests are against the same server, with a SSL certificate that is valid, and works on desktop, and works when the same app is running iOS7. The

what is the advantage of using Alamofire over NSURLSession/NSURLConnection for networking?

依然范特西╮ 提交于 2019-12-04 22:33:05
Can anyone help me in understanding these question : What is the advantage of using Alamofire over NSURLSession/ NSURLConnection? What are the differences between NSURLSession and NSURLConnection? NSURLConnection is Apple's old API for doing networking (e.g. making HTTP requests and receiving responces), while NSURLSession is their new one. The latter one is higher level and is generally much easier and involves less boilerplate code to use for most application developers - there's basically no reason to use the former except in legacy code that you don't want to update. A bit of history:

NSURLConnection : JSON text did not start with array or object and option to allow fragments not set

北城余情 提交于 2019-12-04 22:29:27
I get the following error from NSURLConnection connectionDidFinishLoading "The operation couldn’t be completed. (Cocoa error 3840.)" (JSON text did not start with array or object and option to allow fragments not set.) UserInfo=0x7b71dbb0 {NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.} I used the following code : -(void)connectionDidFinishLoading:(NSURLConnection *)connection { NSError *error; id json = [NSJSONSerialization JSONObjectWithData:_urlData options:kNilOptions error:&error]; if (error) { NSLog(@"Loading Error = %@",error); } }

NSURLConnection Error code (-1202,1012)

强颜欢笑 提交于 2019-12-04 22:24:23
I am using NSURLConnection for one field service type iOS appliation, so app is field service type there are more then 50 users and more then 50 users may use the application on same time that's why there are more then 50 or 60 request come to the server. Now my issue is I have received below two errors frequently means every single user can face this error more then 5 times in one day. so it become a challenge for me. The Error Code: -1202 NSURLErrorServerCertificateUntrusted -1012 NSURLErrorUserCancelledAuthentication I have searched a lot and i found that they are server related errors but