0

我在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];
    }
}
4

1 回答 1

0
theRequest.showAccurateProgress = YES;

这将开启准确的进度跟踪。请注意,它在某些情况下会影响性能。有关更多信息,请参阅文档

于 2012-12-29T08:23:50.967 回答