标签:
在开发某个项目的时候,因为项目需要导入视频,这个在Simulater中测试遇到了麻烦,因为在Simulater中,没有视频,只有几个图片,但是在真机上测试的时候,我又闲麻烦,所以,直接写了一个简单的将视频导入Simulater中的Demo。
源码如下:
#import "ViewController.h" @interface ViewController () @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; NSArray *videos = [[NSBundle mainBundle] pathsForResourcesOfType:@"m4v" inDirectory:nil]; for (id item in videos) { UISaveVideoAtPathToSavedPhotosAlbum(item, self, @selector(video:didFinishSavingWithError:contextInfo:), nil); } } - (void)video:(NSString *)videoPath didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo { if(error != nil) { NSLog(@"%@", error); } else { NSLog(@"复制视频成功"); } } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; } @end
Demo的GitHub地址:https://github.com/are1/CopyVideoToSimulater
标签:
原文地址:http://my.oschina.net/are1OfBlog/blog/499229