iOS 如何判断应用的蜂窝是否开启

import

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

你可能感兴趣的:(iOS 如何判断应用的蜂窝是否开启)