Need Reachability version for ARC in iOS5

前端 未结 8 1584
萌比男神i
萌比男神i 2021-02-01 15:29

Using Apple\'s Reachability code in iOS5 I get a bunch of compilation errors as shown below. Any ideas on what is happening here? I\'m using ARC so I have edited the standard co

相关标签:
8条回答
  • 2021-02-01 16:07

    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; 
    }
    
    0 讨论(0)
  • 2021-02-01 16:09

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

    Here is the link to the sample by Apple

    0 讨论(0)
提交回复
热议问题