Need Reachability version for ARC in iOS5

安稳与你 提交于 2019-12-02 18:52:48

I wrote a clean 'drop in' version of reachability for ARC and iOS5 - you can get it here: https://github.com/tonymillion/Reachability

You don't really need an ARC version of Reachability, just simply disable ARC for reachability file(s)

Disable ARC on MULTIPLE files:

  • Select desired files at Target/Build Phases/Compile Sources in Xcode
  • PRESS ENTER
  • Type -fno-objc-arc
  • Press Enter or Done

You also have a missing framework. Add SystemConfiguration framework.

I rearranged them for IOS 5 and arc they are working tested

Please DON'T FORGET TO ADD SystemConfiguration.framework on your project

I just found this that might help. Thank the author for this (this is not mine)!

https://gist.github.com/1182373

Apple's reachability has been updated to version 3 which now supports ARC iOS5+

Here is the link to the sample by Apple

You need to add the systemConfiguration.framework to make Reachability work.

Kasper Munck

I know this thread is old, but in case anyone is interested you can solve this by disabling ARC for Reachability.m. Look at this post.

Tony, is your class correctly work even with a non ARC project? I can see lot ok Reachability: dealloc in my consolle, and I don't know if it's normal or not! I use this method to check the connection (is the only place where I user Rechability)

-(BOOL)checkConnection{
    BOOL connessione = FALSE;
    Reachability *wifiResouce       = [[Reachability reachabilityForLocalWiFi] retain];
    Reachability *phoneResouce      = [[Reachability reachabilityForInternetConnection] retain];

    NetworkStatus netStatusWiFi     = [wifiResouce currentReachabilityStatus];
    NetworkStatus netStatusPhone    = [phoneResouce currentReachabilityStatus];
    if(netStatusWiFi == NotReachable){
        if(netStatusPhone == ReachableViaWWAN){
            connessione = TRUE;
        }
    }else if(netStatusWiFi == ReachableViaWiFi){
        connessione = TRUE;
    }
    [phoneResouce release];
    [wifiResouce release];
    return connessione; 
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!