如何从you-tube下载视频并保存在我的app文件夹中。我有videoID
,但没有工作代码。我找到了这个链接,但是这个链接的代码对我不起作用。
Save Youtube video to iPhone in the app
如果有人有任何工作代码,请与我分享,谢谢。
答案 0 :(得分:1)
设置您的YouTube网址
- (void)downloadMultiAFN:(NSString *)userIDFrom messageId:(NSString *)msgId message:(NSString *)message url:(NSString *)url contact:(NSString *) contact nickName:(NSString *)nickName {
imageUrlPathForSharingMessgeId=msgId;
NSURL *URL = [NSURL URLWithString:url];
NSURLRequest *request = [NSURLRequest requestWithURL:URL];
AFHTTPRequestOperation *downloadRequest = [[AFHTTPRequestOperation alloc] initWithRequest:request];
[downloadRequest setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
NSData *data = [[NSData alloc] initWithData:responseObject];
// you can save video or image with avi or png
// [[DBManagernew getSharedInstance] saveDataUploadImage:msgId isRead:NO isSend:YES isReceipt:NO image:data];
// imageIsSelected=NO;
// [self fetchAllMessage];
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"file downloading error : %@", [error localizedDescription]);
}];
[downloadRequest start];
}