【发布时间】:2014-06-14 05:10:28
【问题描述】:
我有一个非常简单的方法。但是在方法中 UIAlertView 不会运行....这是我的方法:
-(void)post_result {
NSLog(@"Post Result");
post_now.enabled = YES;
[active stopAnimating];
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Success" message:@"You're post has been successfully uploaded." delegate:self cancelButtonTitle:@"Dismiss" otherButtonTitles:nil];
[alertView show];
success_post_facebook = 0;
success_post_youtube = 0;
success_post_googleplus = 0;
success_post_tumblr = 0;
success_post_twitter = 0;
NSLog(@"Post Result END");
}
奇怪的是,UIAlertView 前后的代码都会在这个方法中运行....那么到底是怎么回事??
感谢您的宝贵时间。
【问题讨论】:
-
调试器中有什么东西吗?您是否在单独的线程中调用此“post_result”?如果您希望得到一个好的答案,我会发布更多代码。
-
它不会运行是什么意思 - 它不显示吗?
-
确保在主线程上显示警报。
-
你怎么打电话给
post_result? -
是的@rmaddy 你是对的。我通过内置的 Twitter API 从 Twitter API 请求中调用该程序。这必须使该方法在单独的线程中运行。谢谢。
标签: ios objective-c cocoa-touch methods uialertview