gpt4 book ai didi

cocoa - 在 cocoa Web View 中进行 nsurldownload 后,nsprogressindicor 进度未完全完成

转载 作者:行者123 更新时间:2023-12-03 17:12:52 25 4
gpt4 key购买 nike

我的进度指示器在 cocoa webview 中不起作用我使用了此代码 -

   -(void)download:(NSURLDownload *)download didReceiveResponse:(NSURLResponse *)response { 
NSLog(@"downl didreceiveresponse here");
NSLog(@"Recieved reponse with expected length: %lli", [response expectedContentLength]);
payload=0;
[payload setLength:0];
[progrssbar setMaxValue:[response expectedContentLength]] ;
[self setProgrssbar:progrssbar];
}
- (void)connection:(NSURLConnection *)conn didReceiveData:(NSData *)data
{
NSLog(@"Recieving data. Incoming Size: %li Total Size: %li", (unsigned long)[data length], (unsigned long)[payload length]);
[payload appendData:data];
[progrssbar setDoubleValue:[payload length]];
}
- (void)download:(NSURLDownload *)download didReceiveDataOfLength:(unsigned)length
{
NSLog(@"downl receivedata here%i",length);
[progrssbar setHidden:NO];
[progrssbar setIndeterminate:NO];
[progrssbar startAnimation:self];
[progrssbar setDoubleValue:(double)length]; [progrssbar displayIfNeeded];
}

最佳答案

有效负载到底声明为什么?我使用了类似的代码,声明了 NSMutableData *payload ,然后在 -(void)download:(NSURLDownload *)download didReceiveResponse:(NSURLResponse *)response 中使用了 payload=[NSMutableData data] 而不是您的 payload=0,也许这就是问题所在?

关于cocoa - 在 cocoa Web View 中进行 nsurldownload 后,nsprogressindicor 进度未完全完成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16167200/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com