This is the program that i make.
But i doesn’t run good. when i open this program on iphone it immediatly turn off.
I will show my code and answer me what is the problem.
UIImagePickerController * videoRecorder = [[[UIImagePickerController alloc] init] autorelease];
videoRecorder.delegate = self;
videoRecorder.sourceType = UIImagePickerControllerSourceTypeCamera;
NSArray *sourceTypes = [UIImagePickerController availableMediaTypesForSourceType:videoRecorder.sourceType];
if (![sourceTypes containsObject:(NSString*)kUTTypeMovie] ) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil
message:@"Device Not Supported for video Recording."
cancelButtonTitle:@"Yes"
otherButtonTitles:@"No",nil];
[alert show];
[alert release];
return;
}
videoRecorder.sourceType = UIImagePickerControllerSourceTypeCamera;
videoRecorder.mediaTypes = [NSArray arrayWithObject:(NSString*)kUTTypeMovie];
videoRecorder.videoQuality = UIImagePickerControllerQualityTypeLow;
videoRecorder.videoMaximumDuration = 120;
videoRecorder.delegate = self;
self.recorder_ = videoRecorder;
[videoRecorder release];
[self presentModalViewController:self.recorder_ animated:YES];
First: Use the code formatter in the future please. This hurts to look at.
Second: You’re double releasing UIImagePicketController (videoRecorder) auto-release will release it after the current runloop exits, but you’re also explicitly releasing it near the end of your method call here, so when iOS cleans up the auto-release pool, it will get a double release and crash.
I can’t read the rest of this well due to the formatting, but that seems like your most likely bet for what’s causing the crash.