Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 671
Andrew Avatar asked Apr 15 '12 16:04

Andrew


1 Answers

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.

like image 186
CodaFi Avatar answered Nov 08 '22 08:11

CodaFi