Idan
Idan

Reputation: 9940

Camera crash instantly when using PhotoPickerPlus on my iPhone

I'm using PhotoPickerPlus to get photos from the camera, When using to get photos from library everything works just fine but when from camera it crash when the camera screen opens.

This is the code I'm using to initiate this call:

-(void)pickPhotoAction{

PhotoPickerPlus *temp = [[PhotoPickerPlus alloc] init];
[temp setDelegate:self];
[temp setModalPresentationStyle:UIModalPresentationCurrentContext];

switch ([[NSUserDefaults standardUserDefaults] integerForKey:kSourceChosen]) {
    case SourceTypeCamera:
        [temp setSourceType:PhotoPickerPlusSourceTypeCamera]; // Open Camera
        break;
    case SourceTypeLibrary:
        [temp setSourceType:PhotoPickerPlusSourceTypeLibrary]; // Open select from sources directly
        break;

    default:
        break;
}

[self presentViewController:temp animated:YES completion:^(void){
    [temp release]; //[temp release];
}];

}

when kSourceChosen is just the key I save to know which button the user pressed and get back to that later on flow.

I must say that at some point it had worked but I can't recall changing anything related to that...

Please help.

Upvotes: 0

Views: 130

Answers (1)

Josh Heartford
Josh Heartford

Reputation: 26

when the camera and photo picker open, it can produces a HUGE memory hit. If your code worked before, and now its being sporadic, just for kicks, try closing a bunch of apps, and restarting your phone and see if it stays running.. if so, then you may be able to confirm that it is a memory related issue.. and to investigate further, put some break points in

- (void)didReceiveMemoryWarning {

}

.. if it does turn out to be a memory related issue, try to free up memory before opening the camera

not sure if this will lead you down the right path, but it is something to try.

Upvotes: 1

Related Questions