zoukankan      html  css  js  c++  java
  • iOS 检测网络切换

      CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), //center

                                        NULL, // observer

                                        onNotifyCallback, // callback

                                        CFSTR("com.apple.system.config.network_change"), // event name

                                        NULL, // object

                                        CFNotificationSuspensionBehaviorDeliverImmediately);

     

    staticvoid onNotifyCallback(CFNotificationCenterRef center, void *observer, CFStringRef name, constvoid *object, CFDictionaryRef userInfo)

    {

        NSString* notifyName = (__bridgeNSString*)name;

        // this check should really only be necessary if you reuse this one callback method

        //  for multiple Darwin notification events

        if ([notifyName isEqualToString:@"com.apple.system.config.network_change"]) {

    }

    }

  • 相关阅读:
    知多少进程?
    提高.NET应用性能
    战术设计DDD
    win7下exe文件设置为开机启动
    CQRS项目
    DDD总览
    ML.Net Model Builder
    MySQL主主复制搭建教程收集(待实践)
    MySQL主从复制搭建教程收集(待实践)
    MySQL集群方案收集
  • 原文地址:https://www.cnblogs.com/XCoderLiu/p/4459404.html
Copyright © 2011-2022 走看看