【发布时间】:2013-03-21 20:08:06
【问题描述】:
我有一个视频应用程序,她所做的只是播放单个 .mp4 文件。 我想将该文件保存到将播放的 iphone 中的相机胶卷中。 我已经有了代码,但由于某种原因视频无法保存。
没有错误,似乎没有放错地方,但仍然没有保存。 我花了几个小时托盘来解决这个问题,但没有成功。 如果有人可以帮我解决这个问题?请?请问漂亮吗? 这是保存功能的代码...
- (IBAction)save{
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
// don't forget to link to the AssetsLibrary framework
// and also #import <AssetsLibrary/AssetsLibrary.h>
NSString *filePathString = [[NSBundle mainBundle] pathForResource:@"video_name" ofType:@"mp4"];
NSURL *filePathURL = [NSURL fileURLWithPath:filePathString isDirectory:NO];
if ([library videoAtPathIsCompatibleWithSavedPhotosAlbum:filePathURL]) {
[library writeVideoAtPathToSavedPhotosAlbum:filePathURL completionBlock:^(NSURL *assetURL, NSError *error){
if (error) {
// TODO: error handling
} else {
// TODO: success handling
}
}];
}
}
【问题讨论】:
-
拜托我没有任何想法,它让我的项目陷入困境。因此,如果有人可以帮助我,我将不胜感激
-
这个问题已经被问了一周了..仍然没有答案???这个网站是干什么用的?只是为了发布代码?或尝试解决问题...
标签: ios