美文网首页
选择了wifi蜂窝数据后调用

选择了wifi蜂窝数据后调用

作者: tivon_lee | 来源:发表于2018-08-01 16:40 被阅读7次

    有权限后去调用
    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 = CTCellularData()
    cellularData.cellularDataRestrictionDidUpdateNotifier = { (state) in
    switch state {
    case .restrictedStateUnknown:
    break

                case .restricted:
                    break
                    
                case .notRestricted:
                    self.todo()
                    break
                }
            }
        }
        else {
            self.todo()
        }
    }

    相关文章

      网友评论

          本文标题:选择了wifi蜂窝数据后调用

          本文链接:https://www.haomeiwen.com/subject/sgervftx.html