If you’re using Apple’s reachability framework and compiling with OS4 beta SDK, you might get a crash like this:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** +[Reachability<0xf37d0> init]: cannot init a class object.'
You can fix it by commenting out the [super init] line in + (Reachability*) reachabilityForLocalWiFi in Reachability.m:
+ (Reachability*) reachabilityForLocalWiFi; { //[super init]; struct sockaddr_in localWifiAddress; bzero(&localWifiAddress, sizeof(localWifiAddress)); localWifiAddress.sin_len = sizeof(localWifiAddress); localWifiAddress.sin_family = AF_INET; // IN_LINKLOCALNETNUM is defined in <netinet/in.h> as 169.254.0.0 localWifiAddress.sin_addr.s_addr = htonl(IN_LINKLOCALNETNUM); Reachability* retVal = [self reachabilityWithAddress: &localWifiAddress]; if(retVal!= NULL) { retVal->localWiFiRef = YES; } return retVal; }
This happened to me with with 4.0. I never thought I would find as useful search result as finding this when searching for:
Reachabilityinit ]: cannot init a class object.
Thank you!
Tahnk you, but is most easy download the source code…
http://developer.apple.com/iphone/library/samplec…
The version with //[super init]; is 2.2 for this code
Than you
word, I'm sure they have fixed it by now. I haven't looked since I pulled it from Apple.thanks!-Andrew