void RequestCompletionHandler(NSUrlResponse responce, NSData data, NSError error) { UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false; if (error != null) { HandleError(error); } else { var httpResponse = (NSHttpUrlResponse)responce; if (httpResponse.StatusCode / 100 == 2 && responce.MimeType == "application/json") { var parseOperation = new APLParseOperation(data, PersistentStoreCoordinator); parseQueue.AddOperation(parseOperation); } else { var userInfo = new NSDictionary(NSError.LocalizedDescriptionKey, "Problems with connection."); var reportError = new NSError(new NSString("HTTP"), httpResponse.StatusCode, userInfo); HandleError(reportError); } } }
private void RequestCompletionHandler (NSUrlResponse responce, NSData data, NSError error) { UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false; if (error != null) { HandleError (error); } else { var httpResponse = (NSHttpUrlResponse)responce; if (httpResponse.StatusCode / 100 == 2 && responce.MimeType == "application/json") { var parseOperation = new APLParseOperation (data, PersistentStoreCoordinator); parseQueue.AddOperation (parseOperation); } else { var errorString = new NSString ("Problems with connection."); var userInfo = NSDictionary.FromObjectAndKey (errorString, NSError.LocalizedDescriptionKey); var reportError = new NSError (new NSString ("HTTP"), httpResponse.StatusCode, userInfo); HandleError (reportError); } } }