In the development of a project, because the project needs to import video, this test in the Simulater encountered trouble, because in Simulater, there is no video, only a few pictures, but on the real machine test, I was idle trouble, so, Directly write a simple video into the demo in Simulater.
The source code is as follows:
#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 (@ "copy video succeeded");} } -(void) didreceivememorywarning { [Super didreceivememorywarning];} @end
Demo's github address: Https://github.com/are1/CopyVideoToSimulater
Import Video into iOS simulator