0

我已经在运行UIAlertView,但是在从 Web 服务获取数据期间,我想更新该 AlertView 的消息。所以我写下面的代码来更新警报消息:

[self performSelectorOnMainThread:@selector(UpdateAlertMessage:) withObject:@"Downloading Schedule ..." waitUntilDone:NO];

-(void)UpdateAlertMessage:(NSString *)strMessage
{appDelegate.progressAlert.message=strMessage;
}

这里的进度警报是我已经在运行的警报视图。

但我在控制台中给了我以下警告:

wait_fences: failed to receive reply: 10004003

我想删除该警告。有什么帮助吗??

4

1 回答 1

0

您正在主线程上执行此操作,因此请尝试使用 GCD 方法而不是 [selfperformSelectorOnMainThread:@selector(UpdateAlertMessage:) withObject:@"Downloading Schedule ..." waitUntilDone:NO];

像这样

dispatch_async(dispatch_get_main_queue(), ^{ 
  [self UpdateAlertMessage:@"Downloading Schedule ..."];
});

更新

dispatch_queue_t myQueue;
myQueue = dispatch_queue_create("myQueue", NULL);
dispatch_sync(myQueue, ^{
    [self UpdateAlertMessage:@"Downloading Schedule ..."];
});
于 2013-04-10T07:27:14.407 回答