我在我的应用程序中对iphone是新手我通过正常工作的Web服务连接到数据库,但我想在网络连接被禁用时取消警告。请帮助我如何在禁用网络连接时发出警报, 提前谢谢。
答案 0 :(得分:1)
看看这个S.O. entry
特别是,您的主要兴趣点是关于使用Reachability框架检测网络连接的第一个问题。
答案 1 :(得分:0)
使用UIAlertView显示提醒
答案 2 :(得分:0)
当您的代理人/观察员收到有关网络禁用状态的通知时,您可以在UIAlertView
中显示消息。
//show an alert to let the user know that they can't connect...
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Network Status" message:@"Network is not available. Please try again later." delegate:self cancelButtonTitle:nil otherButtonTitles:@"OK", nil];
[alert show];
[alert release];
您还可以使用Reachability API来了解网络连接的状态。