setDelegate:nil]; [aStream close]; [self.client URLProtocol:self didFailWithError setDelegate:nil]; [aStream close]; [self.client URLProtocol:self didFailWithError setDelegate:nil]; [aStream close]; // 通知client发生错误了 [self.client URLProtocol:self didFailWithError
placemarks firstObject]; //place包含了地理信息 }]; } -(void)locationManager:(CLLocationManager *)manager didFailWithError
didUpdateLocationsSubject.onNext(locations) } public func locationManager(_ manager: CLLocationManager, didFailWithError locationManager(manager, didFailWithError: error) didFailWithErrorSubject.onNext(error) } didUpdateLocationsSubject.asObservable() } /** Reactive wrapper for `delegate` message. */ public var didFailWithError
connectionWithRequest:request delegate:self]; [connection start]; 请求出错 (void)connection:(NSURLConnection )connection didFailWithError
因此,我们还需要实现错误处理的委托方法connection:didFailWithError::objc- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error { NSLog(@"Connection failed with error: %@", error);}总结通过上述步骤,我们实现了一个基本的音频爬虫
locationManager.delegate = self; #pragma mark - 定位失败 -(void)locationManager:(CLLocationManager *)manager didFailWithError } } #pragma mark - 定位失败 -(void)locationManager:(CLLocationManager *)manager didFailWithError
[self.myLocationManager stopUpdatingLocation]; } (void)locationManager:(CLLocationManager )manager didFailWithError
} func connection(connection: NSURLConnection, didFailWithError error: NSError) { println
receivedData } //网络请求过程中,出现任何错误,如断网,连接超时等,会进入此方法 - (void)connetion:(NSURLConnection *)connetion didFailWithError
密码不对等不会调用) - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error { NSLog
product.productIdentifier), Price: \(product.price)") } } func request(_ request: SKRequest, didFailWithError Product: %@, Price: %@", product.productIdentifier, product.price);}}(void)request:(SKRequest )request didFailWithError
LonLatToCity() } } func locationManager(_ manager: CLLocationManager, didFailWithError
locationServicesEnabled] //检测的是整个iOS系统的位置服务开关, //无法检测当前应用是否被关闭,只能通过CLLocationManagerDelegate的locationManager:didFailWithError
productsRequest.delegate = self; [productsRequest start]; } //弹出错误信息 - (void)request:(SKRequest *)request didFailWithError break; default: break; } } - (void)connection:(NSURLConnection *)connection didFailWithError
} #pragma mark ---- NSURLConnectionDelegate ----- - (void)connection:(NSURLConnection *)connection didFailWithError
*)data{ //正在接收数据 [_data appendData:data]; } -(void)connection:(NSURLConnection *)connection didFailWithError
; } } }]; } //定位失败时调用 - (void)locationManager:(CLLocationManager *)manager didFailWithError
[[SKPaymentQueue defaultQueue] addPayment:payment]; } //请求失败 - (void)request:(SKRequest *)request didFailWithError
stringWithFormat:@"%@",dict]; } pragma mark - 接收错误 (void)connection:(NSURLConnection )connection didFailWithError
NSData *)data { [self.responseData appendData:data];}- (void)connection:(NSURLConnection *)connection didFailWithError