iOS development & running

@vtim - iOS development and running

May 10

Groovy-script to send iOS push notifications

When testing your iOS-app for the handling of push notifications, it’s nice to have a quick way to send one or more messages to your device.

Here’s a quick little Groovy-script I wrote that shows how to use java-apns to do just that. See the java-apns documentation for more information on setting things up.

You’ll need to have Groovy installed to run the script. Grape willl automa(t|g)ically resolve the dependencies for you.

Enjoy!


May 3

Embedding GitHub projects in your svn repository

GitHub is the place to be for sharing code. Unfortunately a lot of companies are still using subversion internally. Luckily, GitHub offers read-only svn access to all repositories (See this April-Fools’-that’s-actually-not-a-joke blogpost from 2010).

This means that you can use svn:externals (http://svnbook.red-bean.com/en/1.0/ch07s03.html) to refer to the main repo instead of exporting code from GitHub and then keeping your own version in svn.

Here’s how I am using this to pull down the official facebook-ios-sdk in our “subversioned” project:

If you don’t have a directory to put your “external” code yet, create one and add/commit it:

mkdir libraries
svn add libraries
svn commit libraries -m "Created libraries dir"

Create the SVN_EDITOR variable if it’s not set already you can choose another editor if you like

export SVN_EDITOR=vi

Set the svn:externals property on your libraries directory:

svn propedit svn:externals libraries

Copy/paste this in the editor

facebook-ios-sdk    https://github.com/facebook/facebook-ios-sdk/tags/v1.2/src

Save and quit vi

As you can see in the GitHub url, I’m using the 1.2-tag to avoid build errors when changes are made to the external repo. When there’s a 1.3-tag, I can switch to that one by updating the externals definition using propedit. You can also specify a revision number instead of a tag, if you like.

Don’t forget to commit the libraries-directory so the build-server and your colleagues also have the definition. This will only commit the property on the directory to your repository, not the external code itself.

svn commit libraries -m "Added 'facebook-ios-sdk' externals definition"

Done. When you now update, the external code will also be fetched, so svn update results in:

Fetching external item into 'facebook-ios-sdk'
A    facebook-ios-sdk/FBConnect.h
A    facebook-ios-sdk/FBDialog.bundle
A    facebook-ios-sdk/FBDialog.bundle/images
A    facebook-ios-sdk/FBDialog.bundle/images/close.png
A    facebook-ios-sdk/FBDialog.bundle/images/close@2x.png
A    facebook-ios-sdk/FBDialog.bundle/images/fbicon.png
A    facebook-ios-sdk/FBDialog.h
A    facebook-ios-sdk/FBDialog.m
A    facebook-ios-sdk/FBLoginDialog.h
A    facebook-ios-sdk/FBLoginDialog.m
A    facebook-ios-sdk/FBRequest.h
A    facebook-ios-sdk/FBRequest.m
A    facebook-ios-sdk/Facebook.h
A    facebook-ios-sdk/Facebook.m
A    facebook-ios-sdk/JSON
A    facebook-ios-sdk/JSON/JSON.h
A    facebook-ios-sdk/JSON/NSObject+SBJSON.h
A    facebook-ios-sdk/JSON/NSObject+SBJSON.m
A    facebook-ios-sdk/JSON/NSString+SBJSON.h
A    facebook-ios-sdk/JSON/NSString+SBJSON.m
A    facebook-ios-sdk/JSON/SBJSON.h
A    facebook-ios-sdk/JSON/SBJSON.m
A    facebook-ios-sdk/JSON/SBJsonBase.h
A    facebook-ios-sdk/JSON/SBJsonBase.m
A    facebook-ios-sdk/JSON/SBJsonParser.h
A    facebook-ios-sdk/JSON/SBJsonParser.m
A    facebook-ios-sdk/JSON/SBJsonWriter.h
A    facebook-ios-sdk/JSON/SBJsonWriter.m
A    facebook-ios-sdk/facebook-ios-sdk.xcodeproj
A    facebook-ios-sdk/facebook-ios-sdk.xcodeproj/project.pbxproj
A    facebook-ios-sdk/facebook-ios-sdk.xcodeproj/project.xcworkspace
A    facebook-ios-sdk/facebook-ios-sdk.xcodeproj/project.xcworkspace/contents.xcworkspacedata
A    facebook-ios-sdk/facebook-ios-sdk.xcodeproj/project.xcworkspace/xcuserdata
A    facebook-ios-sdk/facebook-ios-sdk.xcodeproj/project.xcworkspace/xcuserdata/mkijewski.xcuserdatad
A    facebook-ios-sdk/facebook-ios-sdk.xcodeproj/project.xcworkspace/xcuserdata/mkijewski.xcuserdatad/UserInterfaceState.xcuserstate
A    facebook-ios-sdk/facebook-ios-sdk.xcodeproj/xcuserdata
A    facebook-ios-sdk/facebook-ios-sdk.xcodeproj/xcuserdata/mkijewski.xcuserdatad
A    facebook-ios-sdk/facebook-ios-sdk.xcodeproj/xcuserdata/mkijewski.xcuserdatad/xcschemes
A    facebook-ios-sdk/facebook-ios-sdk.xcodeproj/xcuserdata/mkijewski.xcuserdatad/xcschemes/facebook-ios-sdk.xcscheme
A    facebook-ios-sdk/facebook-ios-sdk.xcodeproj/xcuserdata/mkijewski.xcuserdatad/xcschemes/xcschememanagement.plist
A    facebook-ios-sdk/facebook_ios_sdk_Prefix.pch
Updated external to revision 119.

Feb 16

Some observations on Android

Although I already worked on some Android applications, I mostly used the low-end devices for testing. Cheap phones such as the HTC Wildfire and Sony Ericsson Xperia X8. You can’t even compare these devices to an iPhone 4, which is still my main phone. So, I was really glad to have a top-of-the-line Android phone fall in my lap. I haven’t been using it very much, but here are some quick thoughts.

Setting up

When setting up the phone, you’re supposed to log into your Google account before you get the chance to connect to a wireless network. Because the SIM we used didn’t have a 3G-subscription, this was a confusing experience.

Fortunately we could skip this step and set up the wi-fi first, and go into Settings to log into Google.

Stock apps

The duplication of stock apps, some by Google and others by Samsung. It’s very confusing to have different email apps installed on the phone by default. Same thing with Calendar and other apps. 

(No) OS Updates

The phone comes with Android 2.3.3 “Gingerbread”, a version of the OS that was released 12 full months ago. The phone has been for sale since 9 months ago.

Four months ago, Android 4.0 “Ice Cream Sandwich” was released. The version we’ve all been waiting for. The version we’re all still waiting for.

According to Google’s own reports, a total of 1% of Android devices is running this “latest and greatest” version of the OS. One. Percent. That’s the same amount as Android 1.6. This is ridiculous.

According to some sources, an update for the Galaxy S II is scheduled to arrive in March.

I wonder if I’ll live to see Jelly Bean on this phone!


Jan 25

Stroke of luck

I have been in a lucky mood recently. When I was less than one year old, I once won a bike by drawing the winning lot out of a basket. Since then, I don’t think I have ever won something of note.

Until recently. On Monday I received two prizes I had won in the last weeks.

First, and biggest thing I got was a Samsung Galaxy S II. At Devoxx last November, I left my business card at the Sogeti booth, and apparently I was the lucky guy to win this Android phone! Who’s even more lucky is my girlfriend, as I’m not planning on abandoning my iPhone 4. She didn’t have a smartphone yet, so I gave it to her. She was happy, but also asked if she couldn’t get the iPhone :)

Another interesting thing is this:

Runalyzer Key

It’s a Runalyzer key, a neat little device to pair an Heart Rate Monitor strap to an iOS device. I won it in a retweet contest organized by fellow iOS developer Cyril Godefroy of 321run.com. Thanks Cyril!

Unfortunately, this key isn’t compatible with the ANT+ standard that’s used by the Garmin Forerunner models, so I had to look hard to find my old Polar chest strap. I already did a quick test, and it’s really simple to use. Just plug in the receiver, and start one of the dozens of compatible apps (of course I can recommend Cyril’s own 321run app). It just works! I can definitely see myself using this when cycling. Runalyzer also provides an iOS SDK, so I may also experiment with that.

For a running geek like, me it’s really nice to see your live heart rate on you phone!

I’m planning to write a more detailed review of both gadgets once I have spent some more time getting to know them, so be sure to check back!