选择了wifi蜂窝数据后调用

【选择了wifi蜂窝数据后调用】有权限后去调用

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { //... self.networkStatus(application, didFinishLaunchingWithOptions: launchOptions) //... return true } func networkStatus(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) { if #available(iOS 9.0, *) { let cellularData = https://www.it610.com/article/CTCellularData() cellularData.cellularDataRestrictionDidUpdateNotifier = { (state) in switch state { case .restrictedStateUnknown: breakcase .restricted: breakcase .notRestricted: self.todo() break } } } else { self.todo() } }

    推荐阅读