English 中文(简体)
NSURLConnection conduct when no Internet
原标题:NSURLConnection behaviour when there is no internet

是否有任何人知道我能找到关于NSURLConnection行为的文件?

我“试图发现,当你发出不成熟的要求时,国家措施网会做些什么,但没有任何网络。 NSURLConnection 是没有时间的,还是只是等到OS网络?

我需要向服务器发出载有数据的非同步请求,但这一请求将在实地使用,因为网络连接最有点。 在这种情况下,我希望一旦有网络,就立即上载数据。

Edit: Looking at reachability, it can t notify me if internet service comes back on (for example, you come back into range of a cell tower). Does anyone know if it is even possible for my application to be notified by the system when there is an internet connection so that it can do its thing?

问题回答

如果没有网络,它就会消失。

你们应当利用可达性来实现这种行为。 当你有网络回来时,就会通知你,并将上载SAP的数据。

Here is your starting point perhaps : iPhone reachability checking

另见:,ARC and GCD Compatible Reachability Level for Ri and MacOS。 替换 Apple/ach

-(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error {
    //When there is no internet connection, you will get an error right away
}

http://developer.apple.com/library/ios/#samplecode/Reachability/Introduction/Intro.html”rel=“nofollow”

Answering your question, the error may be either timeout or "The Internet connection appears to be offline.", depending on the circumstances





相关问题
List Contents of Directory in a UITableView

I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...

iPhone NSUserDefaults persistance difficulty

In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Resize UIImage with aspect ratio?

I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...

Allowing interaction with a UIView under another UIView

Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...

热门标签