Andrew
Andrew

Reputation: 16051

dismissviewcontrolleranimated completion not calling completion on uiimagepickercontroller

This is the code I have:

-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {


    [picker dismissViewControllerAnimated:YES completion:^(void){
        NSLog(@"Test");

    }];
}

It dismisses the modal view controller, but doesn't call the completion argument. Am i doing something wrong?

Upvotes: 8

Views: 15486

Answers (1)

CodaFi
CodaFi

Reputation: 43330

void completion handlers are filled with a simple ^{, I've never seen your syntax before....

[picker dismissViewControllerAnimated:YES completion:^{
        NSLog(@"Test");

    }];

The only possible explanation I can come up with is that your image picker is being dismissed by some other means, and that you are not it's delegate (therefore you would not receive the didFinishPickingMediaWithInfo message). Another possibility could be a failure within the SDK at the time. I know from running a quick example project, that the completion block fires as expected in both syntactical models.

Upvotes: 16

Related Questions