Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<pre><code>#pragma mark - #pragma mark File Names and Paths // Creates the path if it does not exist. - (void)ensurePathAt:(NSString *)path { NSFileManager *fm = [NSFileManager defaultManager]; if ( [fm fileExistsAtPath:path] == false ) { [fm createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil error:NULL]; } } - (NSString *)documentPath { if ( ! documentPath_ ) { NSArray *searchPaths =NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); documentPath_ = [searchPaths objectAtIndex: 0]; documentPath_=[documentPath_ stringByAppendingPathComponent:@"VideoAlbum"]; [documentPath_ retain]; } return documentPath_; } - (NSString *)audioPath { if ( ! AudioPath_ ) { AudioPath_ = [[self documentPath] stringByAppendingPathComponent:@"Demo"]; NSLog(@"%@",AudioPath_); [AudioPath_ retain]; [self ensurePathAt:AudioPath_]; } return AudioPath_; } -(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { NSString *type = [info objectForKey:UIImagePickerControllerMediaType]; if ([type isEqualToString:(NSString *)kUTTypeVideo] || [type isEqualToString:(NSString *)kUTTypeMovie]) { NSURL *videoURL = [info objectForKey:UIImagePickerControllerMediaURL]; NSData *videoData = [NSData dataWithContentsOfURL:videoURL]; tempPath = [[self audioPath] stringByAppendingFormat:@"/%@.mp4",[NSDate date]]; BOOL success = [videoData writeToFile:tempPath atomically:NO]; NSLog(@"%hhd",success); } [[picker presentingViewController] dismissViewControllerAnimated:YES completion:nil]; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload