Skip to content

Instantly share code, notes, and snippets.

@pita5
Created October 16, 2012 13:06
Show Gist options
  • Save pita5/3899156 to your computer and use it in GitHub Desktop.
Save pita5/3899156 to your computer and use it in GitHub Desktop.
if ([NSThread isMainThread])
{
[NSKeyedArchiver archiveRootObject:cache toFile:cachePath];
}
else
{
dispatch_sync(dispatch_get_main_queue(), ^{
[NSKeyedArchiver archiveRootObject:cache toFile:cachePath];
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment