Tag Archives: sdk

[Reachability reachabilityForLocalWiFi] crash with OS4 SDK

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;
}

re: section 3.3.1

In developing an iPhone app for Pullfolio, we initially went with Titanium as Ray had used it before at Intridea, and we are familiar with web technologies. With that we were able to almost finish the app within a week. However, we quickly found limitations of the framework, more specifically, it was non-trivial to make a Photos.app-like thumbnails view without using webview, and to make a single photo view with slideshow that supports pinch/zoom gestures, lazy-loading different versions of images off the Internet on-demand, proved to be close to impossible without us implementing more native UIKit components for the framework.

So we learned and switched to Objective-C, and will never look at a cross-compile option for iPhone and iPad apps again. I agree with @gruber and Jobs, cross-compile solutions mostly yield low quality apps. Also, it always takes a short while for 3rd party solutions to catch up with the latest SDK features, so you will be a step behind your competitors. I think cross-compiling is okay if you’re a consultant building apps for clients who wanted iPhone apps. But if you’re a app developer who wants to write something original and something that provides rich UX, going native the the only way to go. Learning new languages, tools, and frameworks is part of the business of being developers. (we all did switch from php to rails/django, or vb to c#, cvs to svn and then to git).

Also, if you don’t like the app store limitations, you can always develop for the web. With the exception of Flash, Safari on iPhone and iPad works great, instead of using Facebook.app I just hit it in Safari, it works much better than their app IMO. A ton of sites have already made themselves iPad-friendly.