显示手机数据已closures警报

我怎样才能显示这个警报视图? 我知道我需要检查连接与可达性,但如何显示此设置和确定button的警报? 我需要它的iOS 6。

在这里输入图像说明

不幸的是,在iOS 5.1及更高版本中,您无法从您的应用打开设置应用。

如果您使用较小的版本,以下将起作用。

创buildAlert视图,如:

UIAlertView *cellularData = [[UIAlertView alloc] initWithTitle: @"Cellular Data is Turned Off" message:@"Turn on ellular data or use Wi-Fi to access data" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:@"Settings", nil]; [cellularData show]; 

实现clickedButtonAtIndex如下所示:

 - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { if(buttonIndex == 1) { [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=General&path=Network"]] } } 

它会从您的应用程序打开设置应用程序。