How can I set the 30 sec timeout? NSURL
NSString *urlString = [NSString stringWithFormat:@"http://maps.google.com/maps/geo?q开发者_如何学运维=%@&output=csv", [searchBar.text stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
NSError* error;
NSString *locationString = [NSString stringWithContentsOfURL:[NSURL URLWithString:urlString] encoding:NSASCIIStringEncoding error:&error];
From this previous SO question timeout stringwithcontentsofurl
In this case, you might be best off using the NSURLConnection class method +sendSynchronousRequest:returningResponse:error:; it'll return a data object you can initialize your string with (using -initWithData:encoding:). You can specify a timeout by creating an NSURLRequest using its -initWithURL:cachePolicy:timeoutInterval: method, then pass that request as the first parameter of +sendSynchronousRequest:returningResponse:error:.
When you create an NSURLRequest from your NSURL, use requestWithURL:cachePolicy:timeoutInterval: to specify a timeout interval in seconds.  For instance:
NSURLRequest* request = [NSURLRequest requestWithURL: myUrl 
    cachePolicy: NSURLRequestReloadIgnoringCacheData 
    timeoutInterval:30.0];
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论