/**

 * 偵測目前連線的網路是3G/4G or Wifi

 */

- (NetworkStatus)detectWWANOrWifi

{

    Reachability *reachability = [ReachabilityreachabilityForInternetConnection];

    [reachability startNotifier];

    

    NetworkStatus status = [reachability currentReachabilityStatus];

    [reachability stopNotifier];

    

    return status;

}

 

參考資料:

http://stackoverflow.com/questions/7938650/ios-detect-3g-or-wifi

https://developer.apple.com/library/ios/samplecode/Reachability/Introduction/Intro.html

arrow
arrow
    全站熱搜

    小賢 發表在 痞客邦 留言(0) 人氣()