Iphone UIAlertView:wait_fences:未能接收回复:10004003
我已经运行了Iphone UIAlertView:wait_fences:未能接收回复:10004003,iphone,ios,ipad,Iphone,Ios,Ipad,我已经运行了UIAlertView,但是在从Webservice获取数据的过程中,我想更新该AlertView的消息。因此,我编写以下代码来更新警报消息: [self performSelectorOnMainThread:@selector(UpdateAlertMessage:) withObject:@"Downloading Schedule ..." waitUntilDone:NO]; -(void)UpdateAlertMessage:(NSString *)strMessage
UIAlertView
,但是在从Webservice获取数据的过程中,我想更新该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
我想删除那个警告。
任何帮助???您正在主线程上执行此操作,因此请尝试使用GCD方法,而不是[self
performselectornmainthread:@selector(UpdateAlertMessage:)with object:@“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 ..."];
});
你在哪里调用这个方法???在视图中将出现:
???我在XML解析数据期间调用此方法,即-(void)elementFound:(const xmlChar*)localname prefix:(const xmlChar*)prefix uri:(const xmlChar*)uri namespaceCount:(int)NamespaceCount这是因为有两个线程,您正在尝试调用主线程,而主线程反过来调用另一个线程。可能重复:Setwaituntldone:YES
然后看看会发生什么。我也尝试了此操作,但在iPad中运行时仍会发出相同的警告,即等待提示:无法收到回复:10004003@Divyajain请尝试更新的答案。试着创建自己的队列和测试,我用你的更新答案进行了测试,并在iPad上进行了测试。但每当队列仍在执行时,它都会发出相同的警告。此警告是否使应用程序崩溃??或者我可以继续这个警告吗?它是一样的:wait_fences:未能接收回复:10004003迭代循环中一定有什么事情发生。