Need Reachability version for ARC in iOS5

前端 未结 8 1614
萌比男神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; 
    }
    

提交回复
热议问题