Google Android Development Agency SASS

Tuesday, 5 May 2009

Lots of weird errors with iPhone 3.0 SDK Beta

Today is the first day I've been doing iPhone 2.2.1 development alongside the iPhone 3.0 beta and I can tell you that things have not gone to plan.

The first nightmare I encountered was to do with the naming of my 2.2.1 app. The name has a space in it (which is not technically allowed I now understand although nothing has ever moaned before). When I tried to compile the app using the 2.2.1 framework I get the error:

com.apple.tools.product-pkg-utility: error: CFBundleIdentifier 'com.yourcompany.Project_name' contains illegal character '_'


The first thing to note here is that the only thing that's changed on this Mac since the last time I compiled the app is that I've installed the iPhone 3.0 beta SDK.

The only way I've found to get around this so far is to manually edit the "Identifier" field in the project settings to remove the space, and hard code to package identifier (not good).

The next weird thing happened when I tried running the app on a connected iPhone. (In fact the iPhone that I've been using for all of the development up until now).
When I first ran the app from XCode I received the error "The application is already installed on the device".

Obviously the app is already installed, I've been developing it for months! Normally XCode would just overwrite the app and keep all of your application settings and data, but now it seems I have to manually delete the app from the phone before hitting build and go. Extremely frustrating!

This last problem seems a little unpredictable too - I've just ran the app twice from XCode without uninstalling it and it hasn't popped up the error yet. We shall see...

I should state that all of this is with me targetting 2.2.1, I haven't ran it under 3.0 yet.

If I come up with anymore solutions or problems, I'll update this post but for now I'd better get back to making it work!

Friday, 1 May 2009

iPhone 3.0 Features

After a mammoth 2.14Gb download, the iPhone 3.0 SDK beta finally landed on my Mac.

I'm not taking any chances installing it on my iPhone yet, but there didn't seem to be any problem running the simulator in 3.0 alongside 2.2.1.

On the surface, things seem like business as usual. The one major thing you notice is the new Search function of the homepage.



You now get a little magnifying glass icon on the main screen:

Swiping the screen left gives you a search box. Weirdly, this only seems to search the installed applications. I had assumed that it would be similar to the search widget on Android, whereby you can search Google straight from your homescreen. Certainly this doesn't seem to be the case for the simulator anyway, we'll see when I get it running on a phone.



With over 1000 new API's there are clearly some major new things going on with iPhone 3.0. To get you ready for the change, Apple have created some good documentation about ensuring backwards and forwards compatability with your apps. Log into the iPhone developer center and check them out.

Thursday, 30 April 2009

A bit about me

Since I've had this blog for a little while now, without much background about me, I thought it might be worth sticking a post on to talk a bit about my background.

I've been working in software development for over 10 years, mostly based in and around Manchester and Cheshire.

I'm working these days as Senior Technical Architect at the Cheshire based agency SASS Digital.

I spend much of my time focusing on mobile development, notably iPhone development and Google Android development. We pioneered the Tub Thumper drum machine app on the Android platform, an app which was very successful and attracted interest from Google, HTC and T-Mobile. We're still working on Tub Thumper Pro, this will take advantage of the new audio API's of Android Cupcake so watch this space!

We've also recently been working on a top-secret audio app for the iPhone platform, I can't give away any details except to say that it's for a major client and once it's released should be awesome.

Prior to working here I was Technical Architect (amongst other things) at 3T Productions Ltd in Manchester, a sub-division of the mighty RM (Research Machines). I spent the best part of 10 years working at 3T, for huge clients such as the BBC, the DfES, Ofsted, Penguin Books and Harcourt publishing.

I gained a wealth of experience working in technologies such as ASP.NET and SQL Server and also with standards such as e-GIF and SCORM. Much of my work at 3T was e-learning based, an industry in which we broke new ground with every project.

In my spare time I play lots of guitar and record music, and spend a lot of time working on and driving rusty Citroens, such as my DS. There's a picture of my hotrod styled 2CV below.

My hotrod style 2CV

If you're interested, you can follow me on:

Twitter
Flickr

Enough about me anyway, back to the mobile development!

Showing the debug trace in Umbraco

Whilst developing with Umbraco, you'll quite often come across errors in UserControls where all you'll see is a big red box with not a lot of info as to what the error is and where it occurred.

It's easy to find this info when you know how; just add umbdebugshowtrace=true to your querystring and you'll see the debug stack trace, allowing you to locate the problem.

Friday, 24 April 2009

Problems with Android 1.5 pre release

Just been trying the pre-release of Android 1.5 and hit a problem with one of the new features of the emulator.

With this version, you can create "Android Virtual Devices" (AVDs) which allow you to run multiple configurations of the emulator side-by-side without having to run long command line switches.

I'd created my new 1.5 AVD using

android create avd --name cc --target 3 --sdcard 16M --skin HVGA

but then trying to invoke (emulator @cc) it gave the error

could not locate a virtual device named 'cc'

If you run into this problem, you can diagnose what's wrong by running

emulator -debug avd_config -avd cc

Running this gave me a weird path problem, the emulator was trying to find the .ini file for my AVD in c:\Users\Andy\ instead of e:\andy\. (I'm on Vista and my profile is on drive e:\).

To fix this, all I had to do was create a new environment variable ANDROID_SDK_HOME and point this at the moved profile directory. Restarted the command line so that it would register the variable and all was well.

Now for some Cupcake fun!

Tuesday, 21 April 2009

Using % symbols in NSStrings

Normally, when you use the '%' symbol in an NSString, it's because you want to use a formatter to format some other variable and insert it into the results string.

For example

NSString *myString = [[NSString alloc] initWithFormat:@"Number : %d",5];

Would yield the string "Number : 5".

However, we've had a few cases where we need to output a percentage in a string, e.g. "50%". I spent a few minutes searching for complicated solutions, before it dawned on me that all you need to do is escape the % sign, thus telling the compiler that you don't want to invoke a formatter:

NSString *myStrWithPercent = [[NSString alloc] initWithFormat:@"%@%%",myNumber];

Yields "50%". The % sign escapes the second %. Simples!

Wednesday, 1 April 2009

Problems with iPhone Ad-hoc Provisioning

We recently had a problem here at SASS Digital whereby an app we currently have in development for the iPhone would not install on a handset, despite the correct provisioning profiles being in place.

To put this into context, we had created an ad-hoc provisioning profile, signed by myself (as Team Leader) and associated this with the UUID of the handset in question. The provisioning profile had been successfully installed on the handset (showing as verified in the Profiles area of the phone) but when we tried to sync the app we got the fateful error:

application could not be verified

The solution, it turns out, was simple:


  1. In xCode, create a new file, choosing "iPhone OS -> Code Signing -> Entitlements" as the type

  2. Call the new file "entitlements.plist" and then open it in xCode

  3. You will see that this file has only one option; get-task-allow. Make sure that this is not checked.

  4. Now, make sure you have your chosen target selected, and click Edit Active Target

  5. In the "Code Signing Entitlements" field, enter "entitlements.plist"

  6. Save everything, clean the build and compile



This solved the problem for us, our app installed on the phone using our pre-installed provisioning profile. Praise Jebus!