Hi there,

I've in my code on method for getting image from UIImagePickerController and 
another one for taking Picture but i have a problem. It seems that my app don't 
know what method he has to call.
I don't know how to explain so here's the code :

//L'utilisateur a selectionner une image.
-(void)imagePickerController:(UIImagePickerController *)imgPicker 
didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo
{
    //On fait disparaitre la vue.
    [self dismissModalViewControllerAnimated:YES];
    NSLog(@"Sauvegarde de l'image"); //Message de log

    //On récupère les informations concernants l'image
    NSData* imageData = UIImagePNGRepresentation(image);
    NSString* imageName = @"tempImage.jpg"; //On lui donne un nom

    //On récupère le path de l'application
    NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, 
NSUserDomainMask, YES);
    NSString* documentsDirectory = [paths objectAtIndex:0]; //On le mets au 
debut

    //On recupere le chemin entier du fichier
    fullPathToFile = [documentsDirectory 
stringByAppendingPathComponent:imageName];
    [imageData writeToFile:fullPathToFile atomically:NO];
    NSLog(@"Photo enregistrée avec succes");


}
As you can see, i'm french :) This code works perfectly, I can access to my 
PhotoLibrary and save the picture in my app but here's the problem :
- (void) imagePickerController:(UIImagePickerController *)picker 
didFinishPickingMediaWithInfo:(NSDictionary *)info
{

    UIImage *image = [info 
objectForKey:@"UIImagePickerControllerOriginalImage"];

    UIImageWriteToSavedPhotosAlbum(image, self, 
@selector(image:didFinishSavingWithError:contextInfo:), nil);

}

- (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error 
contextInfo:(void *)contextInfo
{
    UIAlertView *alert;


    if (error)
        alert = [[UIAlertView alloc] initWithTitle:@"Erreurr"
                                           message:@"Impossible de sauvegarder 
l'image dans l'album photo"
                                          delegate:self cancelButtonTitle:@"Ok"
                                 otherButtonTitles:nil];
    else 
        alert = [[UIAlertView alloc] initWithTitle:@"Succes"
                                           message:@"L'image a bien ete 
enregistre."
                                          delegate:self cancelButtonTitle:@"Ok"
                                 otherButtonTitles:nil];
    [alert show];
    [alert release];
}
The method didFinishPickingMediaWithInfo is no longer call in my app and i 
don't know why. I see that code on stackoverflow and the doc on Xcode doesn't 
seems to be helpful.

Do you have an idea ?

Thanks in advance for your answer.

Regards.

Vavelin Kévin
Twitter | Blog | LinkedIn 
Entrepreneur
Developer OS X / iOS
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to