我有一個vidoe應用程序,她所做的就是播放一個.mp4文件。 我想將該文件保存到iPhone中的相機膠捲中,然後播放。 我已經有了代碼,但由於某些原因視頻無法保存。視頻應用保存.mp4到相機膠捲
沒有錯誤,沒有任何東西似乎放錯地方,但仍然沒有保存。 我花了數小時的時間來解決這個問題,但沒有任何幫助。 如果有人可以幫我弄清楚嗎?請?可以嗎? 這裏是保存功能代碼...
- (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
}
}];
}
}
請我沒有任何idear,它讓我的項目卡住了。所以,如果有人可以幫助我,這將是gratefull – user2229621
這個問題已經被問了一個星期了..仍然沒有答案?這個網站的用途是什麼?只是爲了發佈代碼?或嘗試修復問題... – user2229621