我在YouTube Resumable Uploads 上醒来
使用 ASIHTTPRequest,进度从 0 跳到 1。这是我的代码:
-(void)uploadVideoFile:(NSDictionary *) params
{
if(_location && _location.length != 0)
{
NSURL *url = [NSURL URLWithString:_location];
ASIFormDataRequest *theRequest = [ASIFormDataRequest requestWithURL:url];
[theRequest setRequestMethod:@"PUT"];
NSString *length = [NSString stringWithFormat:@"%lld",[WSKSharerHelper fileSizeWithPath:_filePath]];
[theRequest addRequestHeader:@"Content-Type" value:@"video/quicktime"];
[theRequest addRequestHeader:@"Content-Length" value:length];
[theRequest appendPostDataFromFile:_filePath];
theRequest.delegate = self;
theRequest.uploadProgressDelegate = self;
theRequest.timeOutSeconds = 100;
[[ASIManager manager] addRequest:theRequest];
[[ASIManager manager] startQueue];
}
}