amirtmgr
amirtmgr

Reputation: 303

Error Domain=PlugInKit Code=13 "query cancelled" UserInfo={NSLocalizedDescription=query cancelled} with Objective C Xcode 9.3 iOS 11

I'm using UIImagePickerController to get image from device. I've implemented the following steps:

  1. Permission is taken: Privacy - Photo Library Usage Description - info.plist
  2. Instance of UIImagePickerController is created and presented. Delegate is assigned to self. Camera or Library options are given with UIAlertController.

    -(void) openGallery {
        UIImagePickerController *picker = [[UIImagePickerController alloc] init];
        picker.delegate = self;
        picker.allowsEditing = YES;
    
        UIAlertController *actionSheet = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
    
        [actionSheet addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
        }]];
    
        [actionSheet addAction:[UIAlertAction actionWithTitle:@"Camera" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
            // take photo button tapped.
            picker.sourceType = UIImagePickerControllerSourceTypeCamera;
            [self presentViewController:picker animated:YES completion:NULL];
        }]];
    
        [actionSheet addAction:[UIAlertAction actionWithTitle:@"Photo Library" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
            // PhotoLibrary
            picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
            [self presentViewController:picker animated:YES completion:NULL];
        }]];
    
        [self presentViewController:actionSheet animated:YES completion:nil];
    }
    
  3. On delegate, image has arrived but, when I tried to upload it to server after converting it into base64, the AFNetworking threw error:

    Error Domain=PlugInKit Code=13 "query cancelled" UserInfo={NSLocalizedDescription=query cancelled} with Objective C Xcode 9.3 iOS 11

    #pragma mark- UIImagePicker Delegate
    
    - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary<NSString *,id> *)info{
        UIImage *chosenImage = info[UIImagePickerControllerEditedImage];
    
        [picker dismissViewControllerAnimated:YES completion:NULL];
    
        [self.view setUserInteractionEnabled:NO];
        [self uploadThemeServiceCall: chosenImage];
    }
    

I tried creating OS_ACTIVITY_MODE to disable in environment variable, but it didn't work. I tried other solutions available but still it din't work. It was working fine but now it's not.

Upvotes: 0

Views: 1115

Answers (1)

gaurav bajaj
gaurav bajaj

Reputation: 106

A:) Make sure object chosenImage is not nil. B:) Use NSData *imageData = UIImageJPEGRepresentation(imageObject , 1) to convert chosenImage into NSData . Use this imageData as ur NSUrlRequest body.

Alse show your code for Function uploadThemeServiceCall here.

Upvotes: 1

Related Questions