Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 02-11-2010, 03:01 AM   #37 (permalink)
seligmanc
Registered Member
 
Join Date: Dec 2009
Posts: 4
Default

Quote:
Originally Posted by Magic Hands View Post
This is what I use, hopefully it helps:
Code:
//--------------------------Handles Picking--------------------------
-(void)openPicker 
{
	if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]) 
	{
		UIImagePickerController *picker;
		picker = [[UIImagePickerController alloc]init];
		picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
		picker.allowsImageEditing = YES;
		picker.delegate = self;
		[self presentModalViewController:picker animated:YES];
	}
}

-(void)imagePickerController:(UIImagePickerController *) picker
	   didFinishPickingImage:(UIImage *)imag 
				 editingInfo:(NSDictionary *)editingInfo  
{
	
	someImage = imag;
        [someImage retain];
	//Call some method here that you want to call after they take the picture
	[[picker parentViewController] dismissModalViewControllerAnimated:YES];
}
-(void)imagePickerController:(UIImagePickerController *) picker 
{
	[[picker parentViewController] dismissModalViewControllerAnimated:YES];
}

-(UIImage*)getTheImage
{
	return  image;
}
-(void)setTheImage:(UIImage*)img
{
	image = [img retain];
}
Good luck!

Hi Multi Hands,

I just wanted to draw some more attention to your solution. I have been trying to sort out the use of the UIImagePickerController within my iPhone for about 6 months. I had read probably around 50 posts on the memory issues around this.

I read in lots of places about the app crashing after 5 pictures. However, my app would sometimes work and sometimes crash immediately (switching off the iphone and then back on often helped since it freed up memory).

I found your solution last night and tried it and it worked! I can now carry on with an app that I had stopped developing so thank you VERY much!

I think the fact you increase the referencing count by 1 (using the retain method) is what has fixed my code.

Brilliant and really appreciated,

Charlie
seligmanc is offline   Reply With Quote
 

» Advertisements
» Online Users: 270
15 members and 255 guests
ADY, betterlee, BrianSlick, chits12345, higgey, JohnS., Joseph Nardone, leahov, marshusensei, OneHubCapMissing, Paul10, Phi, Promo Dispenser, RoryHarvey, ziocleto
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,877
Threads: 89,218
Posts: 380,704
Top Poster: BrianSlick (7,129)
Welcome to our newest member, peterkessler45
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 09:07 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.