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

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.

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!

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!