草庐IT

nsurlconnectiondelegate

全部标签

ios - NSMutableURLRequest "The request timed out"问题。 .

我正在尝试使用以下代码在我的应用程序中下载数据NSURL*url=[NSURLURLWithString:@"mydownloadurlstring"];NSMutableURLRequest*request=[NSMutableURLRequestrequestWithURL:urlcachePolicy:NSURLRequestReloadIgnoringCacheDatatimeoutInterval:60.f];NSURLConnection*connection=[NSURLConnectionconnectionWithRequest:requestdelegate:sel

ios - NSURLConnection didSendBodyData 进度

我正在使用POST请求将一些数据上传到服务器,我正在尝试根据didSendBodyData的totalBytesWritten属性更新UIProgressView的进度NSURLConnection的方法。使用下面的代码,我没有正确更新进度View,在完成之前它始终为0.000。我不确定要乘以或除以什么才能获得更好的上传进度。如果能提供任何帮助,我将不胜感激!代码:-(void)connection:(NSURLConnection*)connectiondidSendBodyData:(NSInteger)bytesWrittentotalBytesWritten:(NSIntege

iphone - NSURLConnection didFailWithError connectionDidFinishLoading 同时调用?

关于“didFailWithError”和“connectionDidFinishLoading”他们都可以叫吗?或者它总是一个或另一个? 最佳答案 不可以,不能同时调用。委托(delegate)收到消息connection:didFailWithError:后,它不再收到指定连接的委托(delegate)消息。如果连接成功下载请求,则代理会收到connectionDidFinishLoading:消息。委托(delegate)将不会再收到有关连接的消息,并且可以释放NSURLConnection对象。http://develope

ios - NSURLConnectionDelegate willSendRequestForAuthenticationChallenge 不会在 iOS 8 上被调用

我的服务器提供了几种身份验证方法:NTLM和摘要。我的iOS客户端不会处理NTLM身份验证,因此我实现了connection:willSendRequestForAuthenticationChallenge:委托(delegate)来拒绝NTLM,然后仅将正确的凭据用于摘要式身份验证质询。到目前为止,在iOS7上一切正常。但是在iOS8上,我发现了一个奇怪的行为:connection:willSendRequestForAuthenticationChallenge:委托(delegate)最多不会被调用(95%)!!我得到了这个错误:Error:ErrorDomain=NSPOSI

ios - NSURLConnectionDelegate willSendRequestForAuthenticationChallenge 不会在 iOS 8 上被调用

我的服务器提供了几种身份验证方法:NTLM和摘要。我的iOS客户端不会处理NTLM身份验证,因此我实现了connection:willSendRequestForAuthenticationChallenge:委托(delegate)来拒绝NTLM,然后仅将正确的凭据用于摘要式身份验证质询。到目前为止,在iOS7上一切正常。但是在iOS8上,我发现了一个奇怪的行为:connection:willSendRequestForAuthenticationChallenge:委托(delegate)最多不会被调用(95%)!!我得到了这个错误:Error:ErrorDomain=NSPOSI

iphone - NSUrlConnection 委托(delegate) - 获取 http 状态代码

在iOS中,我如何接收来自Web服务器响应的http状态代码(404,500200等)。我假设它在NSUrlConnectionDelegate中。Objective-C或Monotouch.NET可以回答。 最佳答案 是的,您可以在委托(delegate)方法-didRecieveResponse中获取状态码:-(void)connection:(NSURLConnection*)connectiondidReceiveResponse:(NSURLResponse*)response{NSHTTPURLResponse*http

iphone - NSUrlConnection 委托(delegate) - 获取 http 状态代码

在iOS中,我如何接收来自Web服务器响应的http状态代码(404,500200等)。我假设它在NSUrlConnectionDelegate中。Objective-C或Monotouch.NET可以回答。 最佳答案 是的,您可以在委托(delegate)方法-didRecieveResponse中获取状态码:-(void)connection:(NSURLConnection*)connectiondidReceiveResponse:(NSURLResponse*)response{NSHTTPURLResponse*http

iOS API - NSURLConnectionDelegate 与 NSURLConnectionDataDelegate 之间的区别

谁能给我解释一下NSURLConnectionDelegate之间有什么不同?和NSURLConnectionDataDelegate协议(protocol)。例如,当我在viewDidLoad中编写这样的代码时。[NSURLConnectionconnectionWithRequest:_requestdelegate:self];那么,我需要添加吗?在我的类接口(interface)声明中或两者都是到吗?提前致谢! 最佳答案 NSURLConnectionDataDelegate具有处理数据的功能,而NSURLConnectio
12