views:

2148

answers:

5

Hi all,

I am using iPhone OS 3.0 SDK. My requirement is that I want to get the image from the photo albums library and display it on an image view. I am using the "UIImagePickerController" for that.

But the problem is the "- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)imageeditingInfo:(NSDictionary *)editingInfo" delegate method is deprecated in iPhone OS 3.0 ,

so is there any alternative for getting the Image from the UIImagePickerController.

All suggestions are highly appreciated.

Thanks...

A: 

Speaking of 3.0 here would break your and my NDA with Apple. However I can suggest that you look at the relevant header files (mdfind didFinishPickingImage | grep 3.0 will find what you need quickly).

duncanwilcox
A: 

Some one posted me the answer as below.

In UIImagePickerController.h you can see that there ist a method you can use: - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info;

The documentation does not show this method it is only in the .h file.

but i am still not getting the above method in the .h file

Biranchi
+1  A: 

use this in your implementation file.

-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { [picker dismissModalViewControllerAnimated:YES]; imageView.image = [info objectForKey:@"UIImagePickerControllerOriginalImage"]; }

and don't forget to modify your header file with these two protocols

@interface photoAppViewController : UIViewController '<' UIImagePickerControllerDelegate,UINavigationControllerDelegate '>' remove ' from greater than signs.

Rahul Vyas
A: 

ive used both didFinishPickingImage and didFinishPickingMediaWithInfo and i still get the same error:

Error Domain=NSCocoaErrorDomain Code=4 UserInfo=0x321a70 "Operation could not be completed" (Cocoa error 4)

I cant find this online anywhere...pls hlp

mars
A: 

Hi,

I am using iphone 3.0 SDK and encounter same problem for displaying image in image view control.I have used the code which was suggested by Rahul vyas and it is working fine. I have also used both didFinishPickingImage and didFinishPickingMediaWithInfo.

Annapurna

Annpurna Mishra