reachability - Immediate crash on device using SCNetworkReachabilityGetFlags with iOS app -


i using scnetworkreachabilitycreatewithname & scnetworkreachabilitygetflags test network availability in ios device. when run app in simulator, or run on device, attached debugger, everything's cool. however, when run app on test device detached debugger, crash. [edit: realized didn't indicate where: in call scnetworkreachabilitygetflags] odd thing is, doesn't happen first time run check. happens on second check. , using try/catch absolutely nothing.

the crash immediate. there no delay while async polling occurs , app times out. it's immediate.

this effed. don't understand @ why occurring. getting ready go conference exhibit app , accompanying web app. planning on walking floor show off. i'm restricted keeping iphone/ipod tethered computer in booth.

any ideas? work-arounds don't keep me attached computer? , long-term solutions solve this? use method check network availability every time perform network activity. syncing data cloud, , run check each time sync occurs. feel necessary keep user informed if there's sudden break in network connection.

help????

here's code snippet.

+ (bool) networkconnected { scnetworkreachabilityflags flags = 0; scnetworkreachabilityref netreachability; bool retrievedflags = no;  bool reachable = no;  netreachability = scnetworkreachabilitycreatewithname(cfallocatorgetdefault(), [external_host utf8string]);  @try {     if(netreachability) {         retrievedflags = scnetworkreachabilitygetflags(netreachability, &flags);         cfrelease(netreachability);     }      if(!retrievedflags || !flags)         reachable = no;     else         reachable = yes; } @catch (nsexception *ex) {     reachable = no; } @finally {     return reachable; } 

}


Comments