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:

[cc lang=”bash”]/System/Library/PrivateFrameworks/MobileDevice.framework[/cc]

…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!

 

Resetting the Push Notifications Permissions Alert on iOS

I’m just pasting this from Apple’s Technical note… it’s soooo useful, yet, everytime i need to debug this, i spend at least 15 minutes with google…!.

The first time a push-enabled app registers for push notifications, iOS asks the user if they wish to receive notifications for that app. Once the user has responded to this alert it is not presented again unless the device is restored or the app has been uninstalled for at least a day.
If you want to simulate a first-time run of your app, you can leave the app uninstalled for a day. You can achieve the latter without actually waiting a day by setting the system clock forward a day or more, turning the device off completely, then turning the device back on.

Fixing ‘Text in UITextField moves up after editing’ glitch

I’ve recently come across this glitch in iOS: Text in UITextField moves up after editing (center while editing).

Long short story… when you end editing a textField, if you’re using a custom font, the text might move up. (If you get this glitch). Well, it turns out that this is a font specific problem… it’s not in your code.

So… how will we solve it?. TTX!. In this previous post we explained how to make TTX work in your 64 bit mac. So we’ll begin from there.

[cc lang=”bash”]
Decompile your font. (ttx font.otx will do the trick).
Find the section
Find the attribute, and set it to 0.
Recompile your font. (ttx font.ttx should work).
[/cc]

Try it. If that doesn’t work, you can try changing the ‘ascent’ attribute to 940, and ‘descent’ attribute to -260, which are the values that MuseoFont has.

That worked for me…!

resignFirstResponder, the easy way!

If you have an UIControl in edit mode… but you have no idea which one is it… and you need to resignFirstResponder, there is an easy way to do this. No, you don’t need to hook to notifications. And you don’t need to find the firstResponder. This can be solved with just one call.

What you need to do is…

[cc lang=”objc”][_tableView endEditing:YES][/cc]

Note that you could have anything else rather than a _tableView.
Easy. Right?