Google Android Development Agency SASS
Showing posts with label xcode. Show all posts
Showing posts with label xcode. Show all posts

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.

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!

Tuesday, 10 March 2009

How to: building apps on a jailbroken iPhone

With Apple in chaos when it comes to handling membership to the ADP, sometimes we as developers have no choice but to bypass the official process and get things working anyway we can.

I've just had the pleasure of getting an unsigned iphone app to run on a jailbroken iPhone and given the myriad of different methods out there I though I'd write a quick how to.

I'm assuming you're starting out with a standard (locked) iPhone 3G. (I've not tested this on iPod touch). I'm assuming you're at v 2.2.1 as that's all I've tried this with. You're going to need an Intel Mac - I couldn't get this to work on a PowerBook, even though I can write apps and run them in the simulator on the Powerbook. You also need OS X Leopard, thanks Apple :-(

For the prupose of this tutorial, I'm focusing on getting an existing app to run on an iPhone, to create one from scratch you need to download and install the Pwned developer templates, which are easily located using Google...

  1. First off, you need to jailbreak your iPhone. The easiest way I found was to use QuickPwn. DO NOT USE THIS IF YOU WANT TO UNLOCK YOUR iPHONE AT A LATER DATE!! (See QuickPwn website)
  2. Download QuickPwn and follow the onscreen steps, I had my iPhone jailbroken after about 5 minutes.
  3. Fire up Cydia on your newly jailbroken iPhone, and add a new "Source" in the Manage section, using the url: http://www.iphone.org.hk/apt
  4. Locate the package "Mobile Installation Patch" version 2.2.1 in the "Tweaks" section of Cydia and install it
  5. Reboot your iPhone. It should now be ready to accept any application.
  6. You need to create a self-signed certificate in your keychain to sign your apps with. To do this, run the Keychain access utility from the Utilities folder on your Mac.
  7. In keychain access, click on Certificate Assistant -> Create a certificate from the Keychain access menu.
  8. In the certificate name field, enter "iPhone Pwned Developer" and choose "Self Signed Root". Check the "Let me override defaults" box and click continue
  9. On the next screen, enter a serial number (Any number will do as long as it's not already used in a certificate). Change the certificate type drop down to "Code signing"
  10. Fill in your details on the next screen and then click continue through the rest of the screens.
  11. Once you get to the end, you'll see a new certificate and key pair called "iPhone Pwned Developer". You can now close the keychain access utility.
  12. Next, locate your projects "Info.plist" file and add the following: 

    <key>SignerIdentity</key>
    <string>Apple iPhone OS Application Signing</string>


  13. Save the file and run XCode
  14. Open your project properties in Xcode and add two user defined settings as follows:

    PROVISIONING_PROFILE_ALLOWED NO
    PROVISIONING_PROFILE_REQUIRED NO

  15. In your project settings, make sure that your code signing identity is set to "iPhone Pwned Developer". For reference, my other important settings were: Valid Architectures=armv6, C/C++ Compiler=GCC 4.0
  16. Now, click open the Organizer window and verify that your iPhone is listed under devices. If it isn't try rebooting it and restarting XCode, it should appear. (Obviously plug the cable in first...)
  17. Once your iphone is connected, make sure you set your target to "Device - 2.2.1", clean your build and then click "Build and Go". Your app should now run and appear on your phone!

Even if this doesn't help anybody else, it at least gives me a record of what I did to get things going. It took me two days of messing around to get this working (admittedly some of that was re-installing OSX on the MacBook).

One final thing - I take no responsibility for what you do with this, nor if you brick your phone, wipe your hard drive or blow up the office. If you're not sure what you're doing, don't blame me when things go wrong!