У меня есть следующий метод в моем AppDelegate.Я не могу найти способ обновить метку на updateView и выполнить загрузку через ASIHTTPRequest.В приведенном ниже коде он выполнит загрузку (startUpload), но не обновит метку (updateLabel).Если я закомментирую вызов startUpload, он обновит метку.Я также попытался создать очередь отправки в uploadViewController, и это дало аналогичный результат, когда я мог заставить работать только один из двух методов.
- (void) showProgressView:(NSString *)filePath {
NSView *view = [uploadViewController view];
dispatch_queue_t queue = dispatch_get_global_queue(0,0);
dispatch_async(queue, ^{
// assigns the upload view to the root NSPanel
[box setContentView:view];
});
dispatch_async(queue, ^{
// starts the upload using ASIHTTPRequest
[uploadViewController startUpload:filePath];
});
dispatch_async(queue, ^{
// updates a label in the upload view
[uploadViewController updateLabel];
});
}
В UploadViewController:
-(void)startUpload:(NSString *)filePath {
HandZipper *handZipper = [HandZipper alloc];
zipPath = [handZipper compressHands:(filePath):(processStatus)];
ASIFormDataRequest *request = [[[ASIFormDataRequest alloc] initWithURL:[NSURL URLWithString:@"http://allseeing-i.com/ignore"]] autorelease];
[request setRequestMethod:@"PUT"];
[request setPostBodyFilePath:zipPath];
[request setShouldStreamPostDataFromDisk:YES];
[request setDelegate:self];
[request setUploadProgressDelegate:progressIndicator];
[request setDidFinishSelector:@selector(postFinished:)];
[request setDidFailSelector:@selector(postFailed:)];
[request startSynchronous];
}