The operation couldn’t be completed. (NSURLErrorDomain error -1001.)" UserInfo=0x79f01e00 {NSErrorFailingURLKey=http://<Server IP>/service/test/uploadios, NSErrorFailingURLStringKey=http://http://<Server IP>/service/test/uploadios, NSUnderlyingError=0x79fd9020 "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1001.
-(void)performPhotoUpload
{
NSString *webservicePref = [[NSUserDefaults standardUserDefaults] stringForKey:@"serviceUrlSetting"];
NSURL *projectsURL = [NSURL URLWithString:webservicePref];
id<AGPipe> registrationPipe;
AGPipeline *pipeline = [AGPipeline pipelineWithBaseURL:projectsURL];
registrationPipe = [pipeline pipe:^(id<AGPipeConfig> config) {
[config setName:@"/service/test/uploadios"];
[config setType:@"REST"];
}];
[registrationPipe save:[self extractMultiPartData]
success:^(id responseObject)
{
NSLog(@"Returned Object:%@", responseObject);
}
failure:^(NSError *error)
{
NSLog(@"Error:%@",[error description]);
}];
-(NSDictionary *)extractMultiPartData
{
NSString *filename = self.patientPhoto.accessibilityIdentifier;
//Check if an image was assigned for user
[self hasPhoto:filename];
NSData *imageData = UIImageJPEGRepresentation(self.patientPhoto.image, 0.2);
AGFileDataPart *dataPart = [[AGFileDataPart alloc] initWithFileData:imageData name: @"image"
fileName:filename
mimeType:@"application/octet-stream"];
NSDictionary *imgDict = @{@"data": dataPart};
return imgDict;