iOS 如何判断应用的蜂窝是否开启
2018-07-09 本文已影响12人
jemmy_xl
import <CoreTelephony/CTCellularData.h>
CTCellularData *cellularData = [[CTCellularData alloc] init];
// 状态发生变化时调用
cellularData.cellularDataRestrictionDidUpdateNotifier = ^(CTCellularDataRestrictedState restrictedState) {
switch (restrictedState) {
case kCTCellularDataRestrictedStateUnknown:
NSLog(@"蜂窝移动网络状态:未知");
break;
case kCTCellularDataRestricted:
NSLog(@"蜂窝移动网络状态:关闭");
break;
case kCTCellularDataNotRestricted:
NSLog(@"蜂窝移动网络状态:开启");
break;
default:
break;
}
};
image.png