My name is Jake Marsh. I'm a software creator,

thingy designer, and technology writer. Subscribe via RSS or Twitter.

POWERED by FUSION

Delight Your Users By Pre-filling Forms With JBDeviceOwner

Posted in code and ios

Filling out forms on a phone can really suck. Heck, even on the iPad's awesome screen, I often make plenty of mistakes while typing in information.

When a user first downloads your iOS app, it's quite common for them to need to fill out some sort of "sign up" or some other kind of form.

All of this can add up to a terrible "first run" experience for new users of your app.

What's a developer to do?

Enter: JBDeviceOwner

This simple library, which comes to us from Jake Boxer, uses the name of the user's device to look up and return commonly needed user information from their Address Book record.

Here's what it looks like in action:

JBDeviceOwner *owner = [UIDevice currentDevice].owner;

// owner will be nil if the user's data could not be found.
if (owner != nil) {
  self.firstNameTextField.text = owner.firstName;
  self.lastNameTextField.text  = owner.lastName;
  self.emailTextField.text     = owner.email;
  self.phoneTextField.text     = owner.phone;
}

Jake describes how it works:

It's really simple actually.

Most iPhones are named "Jake Boxer's iPhone" ("sometimes with a different person's name instead of mine). Most iPhones have their owner saved in their address book.

JBDeviceOwner extracts the owner's name from the device name, finds the matching record in the address book, and populates the JBDeviceOwner instance with the data from the record.

If JBDeviceOwner can't figure out the owner's name, or if it can't find a matching record in the address book, it won't return anything.

Obviously this approach, while really neat, isn't going to work for absolutely every user, so you should have a sensible "fall back". I like to "try grabbing" using JBDeviceOwner, and if I don't find anything, try manually asking the user to enter their email, then using that email address to try to locate their contact record.

Try not to over-do it, but I believe when done well, this sort of approach can be an awesome alternative to requiring users to type in a ton of information.

Please Note: Try not to ask your users for a ton of information in the first place, only require what you absolutely need to make your app work.

That being said, A few big name apps are now using this technique, and their "first run" experiences are much nicer, simply prompting the user with a UIActionSheet with, for example: "Would you like to use this information?"

Check out JBDeviceOwner on Github and stop annoying your users today!

Localize Your Apps With Ease Using Greenwich

Posted in code and ios

Oh man, I have waited a long time for a tool like this to come around. I've even attempted to build one myself a couple times.

The process of localizing Cocoa applications has always been a bit of a chore. Various tools are available to facilitate localization of applications, but they all require a fair amount of work. Even when there is demand for localization, many applications are only available in one language. Greenwich is here to change that.

Greenwich is a new, open-source framework that greatly speeds up the process of localizing and translating an iOS or Mac app. At anytime a developer or translator (yep, Greenwich has been built with translators in mind) can make a change to a word or two, relaunch your app and see the changes reflected immediately.

Translator

Setup and usage for iOS and
Mac are very well documented on Greenwich's awesome setup page.

Do yourself a favor and check this out now, if you've ever localized a Mac or iOS app you know what a pain the process can be. Looks like we finally have a great solution.

Literal Syntax for NSArray, NSDictionary & NSNumber

Posted in code and ios

I can't tell you how long I've been waiting for this.

As Joris points out, it appears that Apple has committed the necessary changes to the LLVM project to allow LLVM to fully support the latest Objective-C language features.

Apple committed a new patch to the llvm project adding support for new Objective-C literal syntax for NSArray, NSDictionary and NSNumber. These have previously been documented in the Mountain Lion Xcode release notes but that was still under NDA. Now that these features have been committed to llvm I guess we’re allowed to speak about it.

...and since LLVM isn't under NDA like most of the "developer preview" stuff, this means we can all finally discuss this stuff on our blogs!

Here's a (small) taste of the great new syntax:

NSNumber

NSNumber *someNumber = @31;  // [NSNumber numberWithInt:31]

NSArray

//NSArray *doctors = [NSArray arrayWithObjects:@"Matt Smith", @"David Tennant", @"Tom Baker", nil];
NSArray *doctors = @[@"Matt Smith", @"David Tennant", @"Tom Baker"];

NSDictionary

NSDictionary *tweet = @{
  @"text": @"Hi! I'm a tweet!",
  @"user": @"jakemarsh",
  @"timestamp": @1331664532
};