Hey everyone!
I have this as my full code, under it I will explain what I am doing, the results, and all that other stuff.
Code:
- (IBAction) launchCameraIBAction:(id)sender{
[self performSelector:@selector(cameralaunchVoid) withObject:NULL afterDelay:.1];
[activity startAnimating];
activity.hidden = NO;
status.text = @"Please wait";
}
-(void)cameralaunchVoid{
UIAlertView *notsupported = [[UIAlertView alloc] initWithTitle:@"Sorry..." message:@"Your device does not one of the following: 1. A Camera 2. Supprort for recording video." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
NSArray *sourceTypes =
[UIImagePickerController availableMediaTypesForSourceType:picker.sourceType];
if (![sourceTypes containsObject:(NSString *)kUTTypeMovie ]){
[notsupported show];
[notsupported release];
}
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.mediaTypes = [NSArray arrayWithObject:(NSString *)kUTTypeMovie];
[self presentModalViewController:picker animated:YES];
}
else {
[notsupported show];
[notsupported release];
}
activity.hidden = YES;
[activity stopAnimating];
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{
NSLog(@"Recorded");
next.enabled = YES;
status.text = @"Video Recorded!";
[[picker parentViewController]
dismissModalViewControllerAnimated:YES];
[picker release];
tut1.hidden = YES;
NSFileManager *fileManager = [NSFileManager defaultManager];
NSData* video = [info objectForKey: UIImagePickerControllerOriginalImage];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSURL * docs = [NSURL fileURLWithPath:documentsDirectory];
[video writeToURL:docs atomically:YES];
NSLog(@"Documents directory: %@",
[fileManager contentsOfDirectoryAtPath:documentsDirectory error:NULL]);
}
Ok 1st I start my activity spinner
then I make an error message, but now show it. i then check if the user has a camera, and can record a video. Just so you know I am only supporting video recording. Then I make a UIImagePickerController and show it on the view. Finally In the didFinish.... I dissmis the picker get the NSData (I don't know what else to use) and writeToUrl of my Document Directory.
At the very end I use NSLog to show the contents of that directory.
Errors
After i stop the recording after I have launched the camera, it crashes.
Here is my error message
Code:
2011-06-15 10:35:45.466 Rewinder[1546:707] Store configuration failed. Creating new database. (Error Domain=NSCocoaErrorDomain Code=256 "The operation couldn’t be completed. (Cocoa error 256.)" UserInfo=0x2d9530 {NSUnderlyingException=authorization denied, NSSQLiteErrorDomain=23})
2011-06-15 10:35:45.609 Rewinder[1546:707] Store configuration failed on 2nd attempt: Error Domain=NSCocoaErrorDomain Code=256 "The operation couldn’t be completed. (Cocoa error 256.)" UserInfo=0x2e33e0 {NSUnderlyingException=authorization denied, NSSQLiteErrorDomain=23}
2011-06-15 10:35:45.613 Rewinder[1546:707] *** Assertion failure in +[PLManagedAsset insertInManagedObjectContext:], /SourceCache/PhotoLibraryServices/MobileSlideShow-1194.14/Model/PLPhotoLibrary/Entities/_PLManagedAsset.m:18
I have no idea what it means
It also has a SIGBRT error on that main.m
Code:
int retVal = UIApplicationMain(argc, argv, nil, nil);
Thanks in advanced