February, 2010


15
Feb 10

Monotouch Binding Gotcha

I stumbled across a subtle gotcha while exploring binding Objective-C types in MonoTouch.  As luck would have it, someone else did also and posted a question about it on the MonoTouch IRC channel.  The poster of the question eventually came across the answer and shared it there, and I am going to post it here in case anyone else makes the same mistake and is looking for some answers.

I was following along with the documentation for binding new Objective-C types on the MonoTouch site, and as a way to ease into the binding process, I chose a class to define from the CloudMade SDK that I am looking to expose in MonoTouch.  The class selected was the BBox class (bbox.h) and I went about creating the following API definition shown below:

using System;
using MonoTouch.Foundation;
using MonoTouch.ObjCRuntime;

namespace CloudMade
{
    [BaseType(typeof (NSObject))]
    interface BBox
    {
        [Export("westernLongitude")]
        float WesternLongitude {get;set;}

        [Export("southernLatitude")]
        float SouthernLatitude {get;set;}

        [Export("easternLongitude")]
        float EasternLongitude {get;set;}

        [Export("northerLatitude")]
        float NorthernLatitude {get;set;}

        [Export("asString")]
        string AsString();
    }
}

Once completed, I saved it as BBox.cs and attempted to generate the bindings by invoking btouch on the file.  You can see below the unsuccessful message I received.
 
$ btouch BBox.cs
/var/folders/E4/E44PAZnZGKGpVrmseo2N3++++TI/-Tmp-/9qgrm9nm.lnv/CloudMade/BBox.g.cs(46,71): error CS0117: `CloudMade.BBox' does not contain a definition for `Messaging'
/var/folders/E4/E44PAZnZGKGpVrmseo2N3++++TI/-Tmp-/9qgrm9nm.lnv/CloudMade/BBox.g.cs(28,30): (Location of the symbol related to previous error)
/var/folders/E4/E44PAZnZGKGpVrmseo2N3++++TI/-Tmp-/9qgrm9nm.lnv/CloudMade/BBox.g.cs(57,71): error CS0117: `CloudMade.BBox' does not contain a definition for `Messaging'
/var/folders/E4/E44PAZnZGKGpVrmseo2N3++++TI/-Tmp-/9qgrm9nm.lnv/CloudMade/BBox.g.cs(28,30): (Location of the symbol related to previous error)
Compilation failed: 2 error(s), 0 warnings
btouch: API binding contains errors.

After looking at the errors and seeing the `CloudMade.BBox’ does not contain a definition for `Messaging’ message, it looked as if I was missing a using statement.  However, this was not the case as Messaging is a class in the MonoTouch.ObjCRuntime namespace and that namespace was already included in the using statements.  The problem actually turned out to be that the interface had the same name as the file and that had caused the issues shown above as the temporary classes generated during the process caused conflicts.  The solution to this issue was as simple as renaming the file to something other than whatever the interfaces you are defining are named.
 
So the moral of the story is:

Do not give the file that the API definition is being saved in the same name as one of the interfaces that you are defining.

Steer clear of that and you’ll be binding Objective-C types with ease.


9
Feb 10

Nexus One – First Impressions

My thoughts on the Nexus One and the Android OS?  I like it.  A lot.

Likes:

  • Speed.  I have the older iPhone 3G hardware and from a user experience perspective it was not that bad.  When compared to the Nexus One, however, it is down right sluggish.  This probably isn’t as big of a factor when comparing a 3GS versus Nexus One, but for someone coming from a 3G iPhone, it is a huge plus.
  • Being able to run apps in the background.  Browsing the web while streaming Pandora and downloading an app in the background works flawlessly and shows no noticeable signs of lag or sluggishness.
  • The OLED screen is really nice.  Higher resolution and OLED screen looks great in low-light situations and is supposed to save precious battery by not drawing less power than normal LCD screens.
  • The Android OS is pretty sweet.  It has a lot of nice features like the status bar, an active “desktop” that you can put interactive widgets on as well as app icons, and an easy way to get music and files on and off the device.  
  • Integration with Google Apps is fantastic as expected.  I love getting mail and talk updates in the status bar and the overall experience with the apps on the Nexus One is better than on the iPhone.

Dislikes:

  • Cut and Paste is clunky.  I can see why Apple needed to spend awhile working out the UX issues before rolling it out.
  • The touch interaction with the device has not been as good as the iPhone in my experience.  I am not sure where the blame lies (hardware or software), but I sometimes find it difficult to select elements in the UI.  This is not something that occurs frequently, but in the short time I’ve owned the device, it has occurred enough to be noticeable.
  • 4GB of storage out of the box is lacking.  It is an easy upgrade but given the amount of money that Google is charging for the device, this seems like they are skimping here.
  • The Android Market place experience is integrated nicely but isn’t as tightly integrated as the iTunes App Store.  This is arguably a good or a bad thing depending on how you look at it.  As a user this is a bad thing since it makes finding and buying apps more difficult than just popping open iTunes.  I’ve found the Android Marketplace, both on the phone and the web, hard to browse.

There are a few negatives that I can’t pin exclusively on the device but are still worth noting.  I have been using my AT&T SIM with the Nexus One and most likely will do so until my contract is up in a few months.  With that caveat out of the way, the talk quality seemed poor and the phone gets really hot when talking for periods greater than 10 minutes.  I hesitate to even mention these issues since I am not using the phone on the network it was intended, but  I know there probably are others considering doing what I did, and this feedback might help if someone is on the fence.

The Nexus One is exactly the kind of phone and competition that was needed to push Apple.  I strongly recommend anyone looking for a smartphone to give it serious consideration before running out and getting an iPhone.


1
Feb 10

iPhone Wireframes

I stumbled across a great collection of iPhone wireframe templates tonight while going through my feeds.  It got me thinking about the process I’ve been using to layout and design the app I am working on.

I’ve been using regular 3 x 5’ notecards to sketch out different screens for the iPhone app I am working on.  On the ruled side I’ll scribble notes and call out must/should/wish components of the screens to help prioritize features.  On the blank side I’ve been sketching out wireframes of the screens to help get a feel for the UI and flow of the app.

cards_laid_out

I’ve played around with Balsamiq and, while the tool is fantastic, I find myself still partial to the notecards.  With the same rough dimensions of the iPhone and the flexibility of being able to quickly rearrange and reorder the screens, the cards suit my preferences as a visual-spatial learner well. 

As with most tools and techniques, personal preference plays a large role in how and when they’re employed.  I always enjoy checking out how other people work and try and steal glean ideas from them.  I’ve found the following blogs pretty useful for design, usability, and UX.  I hope they help inspire you to create something cool.

I ♥ wireframes
information aesthetics
everydayUX
Sender 11