Fixing WebKitLocalStorageDatabasePathPreferenceKey crash

I’ve been getting a lot of crashes with the following signature:

Exception Type:  SIGABRT
Exception Codes: #0 at 0x351be32c
Crashed Thread:  0

Application Specific Information:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFDictionary setObject:forKey:]: attempt to insert nil value (key: WebKitLocalStorageDatabasePathPreferenceKey)'

What is this?. It’s pretty well explained here. My workaround?. Quite simple. Call this method as soon as your app launches:

-(void)fixWebkitCrash
{
    NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
    NSString* webkitPath = [defaults objectForKey:@"WebKitLocalStorageDatabasePathPreferenceKey"];
    NSString* bundlePath = [[[NSBundle mainBundle] bundlePath] stringByDeletingLastPathComponent];
    
    if([webkitPath containsString:bundlePath] == NO)
    {
        [defaults removeObjectForKey:@"WebKitLocalStorageDatabasePathPreferenceKey"];
        [defaults synchronize];
    }
}

Hopefully, this will save you a couple hours!.

Fixing 'Show in Finder'

I’ve been dealing with an annoying glitch in OSX 10.8.2. For some reason, ‘show in finder’ breaks down… on its own.

The workaround is…

sudo killall -KILL appleeventsd

Let’s just hope a real fix shows up, sooner rather than later.

Fixing "iTunes was unable to load dataclass” Error

I’ve been dealing with the “iTunes was unable to load dataclass” for several hours. I’ve uninstalled iTunes, Xcode, deleted the Mobile Device Support… reinstalled everything, booted the system, and nothing seemed to work.

After searching for quite some time, i’ve found this post. Long short story, if you delete this framework:

/System/Library/PrivateFrameworks/MobileDevice.framework

…and right afterwards you relaunch Xcode (which will, as a result, reinstall such framework)… you should be able to get rid of this… annoooooooooying problem.

 

UITableView Pull to Refresh

I know, i know. Apple’s iOS 6 introduces a new component (which is already available in the sdk)… that allows you to refresh a table whenever the user pulls it.

However… not everyone is targetting iOS 6 +… at least not yet. So, i’d like to share a link with you. Sam Vermette, a fellow with a couple public github repositories, did an excellent job writing an UIScrollView extension. It’s super easy to setup… clean, and most of all, self contained.

It’s called, simply, SVPullToRefresh. So… Thank you Sam!