Archive

Archive for the ‘iphone’ Category

iPhone Note #1: Provisioning Profile, Code Signing Identity

August 1st, 2009 Rupert Comments off

I have an old iPhone3G (8GB) and just recently bought an iPhone3GS (16GB).

1. Backup and sync old iPhone3G.

2. Power on iPhone3GS (new), insert a sim card and sync it to iTunes. Congratulations, you now have an activated iPhone.

3. Open up XCode -> Organizer.

4. “Use it for development”

5. Copy the identifier

6. Open up a browser, login to http://developer.apple.com and go to the “Program Portal”

7. Under Devices -> Add Devices.

8. Enter a new name, “iphone3GS” and the 40 hex identifier “xxxxxx…”

9. If you try to deploy an application at this point from XCode it will tell you that “A valid provisioning profile for this executable was not found”. Patience as we will create the provisioning profile in the next steps.

10. App Ids -> New App Id.
Description: Applications by gismobiledev
Bundle Seed ID: Generate New
Bundle Identifier (App ID Suffix): gismobiledev.*

11. Provisioning -> New Profile.
Profile: RDG_iPhone3GS_Development_Profile
Certificates: “Check the box” next to your name.
App ID: Choose “Applications by GisMobileDev”
Devices: “Tick the boxes for each device that you want to use”

13. After submitting, I noticed the status to be “Pending”. Refresh after a few seconds and the status changed to: “Active until 30 Oct 2009″. Hmm, something is not right, my previous profile active until May 2010 since I joined the program May 2009. Needs further investigation.

14. Download your new provisioning profile.

15. From the Organizer, add the new provisioning profile. Don’t get too excited. You still can’t deploy on the iPhone3GS device. Why? Read on..

16. If you have an existing application that was code signed from a previous profile, we need to tell XCode to use the new provision profile for the new device.

17. XCode -> Open your application -> Project -> Edit Project Settings. Most likely, the Code Signing Identity is still using the old provisioning profile. Where is it?

18. /Users/rupert/Library/MobileDevice/Provisioning Profiles . You can delete the old profile if you don’t need it. Drop the new provisioning profile from here. Afterwards, check again step 17 above. This time around XCode should detect and display the correct profile.

code_sign_error.png

19. What if you have an existing application identifier for the application? Hey, I just created one from the Program Portal, we need to tell XCode to use that identifier! Navigate to your [application]-info.plist and change the Bundle identifier to gismobiledev.${PRODUCT_NAME:rfc1034identifier}. So if you defined “gismobiledev.apps.*” in your Application Id in step 10, then that’s the same string we use in the Bundle Identifier in info.plist.

codesign.png

20. Build and Go. Enjoy!

UPDATE (JAN 07, 2010)
I am having problems with a “codesign ambiguous” error from XCode. It seems confused because I just added another iphone developer certificate for another company I am working with.

BEFORE:
[1] iPhone Developer: RUPERTO DE GUZMAN
[2] iPhone Developer: RUPERTO DE GUZMAN (89xxxxxxxx)

To resolve this issue, you need to REVOKE [1] above from the PROGRAM PORTAL. After revoking, create a new certificate. Now you should have something like this:

AFTER:
[1] iPhone Developer: RUPERTO DE GUZMAN (EZxxxxxxxx)
[2] iPhone Developer: RUPERTO DE GUZMAN (89xxxxxxxx)

Now, all is good and I don’t have anymore “codesign ambiguous” problems anymore. Note: If you revoke the a certificate, all the developer provisioning profiles associated with the certificate would need to be changed as well. This means most likely you will end up with this process:

step 1: Revoke OLD CERT create NEW CERT
step 2: Create a new DEVELOPER PROVISIONING PROFILE
step 3: Migrate it to the devices.
step 4: BUILD and DEPLOY to devices

When codesigning from XCode, you can now choose from the “PROJECT SETTINGS” which certifcate to use.

CodeSign.png

Categories: iphone Tags:

iPhone Debugging

June 23rd, 2009 rupert Comments off

As not to forget.. its “obj_exception_throw” from debugger -> breakpoints. Very helpful indeed. Note you can click on the image below to get a fullscreen view on my extended Samsung SW2333.. hehe


iphone_debugger.png

Other references.. Download “Lecture 13
(13. Debugging Tips, Searching, Notifications, KVC_KVO (May 13, 2009)) from Stanford University CS193 Class in iTunes.

Categories: iphone Tags:

iPhone Interface Elements

May 20th, 2009 rupert Comments off
Categories: iphone Tags:

iPhone Development Getting Started

May 18th, 2009 rupert Comments off

After moving from Beijing to Manila to Perth to Melbourne, now Im making most of my time in iPhone Development. Last week, I just applied for the iPhone Standard Developer Program and was able to test on an actual iPhone 3G device running on iPhone 2.2.1. Note that I haven’t downloaded the iPhone 3.0 OS Beta yet as I am still figuring things out but will do so in the next two weeks. My carrier sucks and I’ve used 14GB out of my 20GB allowance so Im delaying the download of the iPhone 3.0 SDK. Crap.

iPhone Mind Map.png

Learning curve..

1. First and foremost, you need a Mac and an iPhone.

2. Familiarize yourself with iPhone Developer Central

3. Meet Objective-C.

4. Introduction to Objective-C 2.0 Programming Language

5. Learn Objective C from cocoadevcentral

6. Leopard Guides: Cocoa Objective-C Language

7. Haven’t tried XCode before? Get a brief introduction from BecomeAnXcoder

8. CS193 from Stanford University. I believe it is essential to go through a few documents and tutorials listed above before being lazy and watching the videos.

I strongly recommend going through the Assignments as well.

hello poly.png

9. iPhone Application Programming Guide

10. Read Quartz 2D Programming Guide if you are into graphics.

It’s my practice to learn a language from the Documentation itself before reading through books. But Programming in Objective-C from Stephen Kochan is worth a look. I haven’t read iPhone SDK Development from the Pragmatic Bookshelf but since Bill Dudney is one of the core developers for ObjC, my guess it would be good.

Categories: iphone Tags:

iPhone Note #1: Updated: Code Ambiguous Error. XCode upgrade wont create IPA archive, fails silently.

January 8th, 2009 rupert Comments off

I have an old iPhone3G (8GB) and just recently bought an iPhone3GS (16GB).

1. Backup and sync old iPhone3G.

2. Power on iPhone3GS (new), insert a sim card and sync it to iTunes. Congratulations, you now have an activated iPhone.

3. Open up XCode -> Organizer.

4. “Use it for development”

5. Copy the identifier

6. Open up a browser, login to http://developer.apple.com and go to the “Program Portal”

7. Under Devices -> Add Devices.

8. Enter a new name, “iphone3GS” and the 40 hex identifier “xxxxxx…”

9. If you try to deploy an application at this point from XCode it will tell you that “A valid provisioning profile for this executable was not found”. Dont worry, we will create the provisioning profile in the next steps.

10. App Ids -> New App Id.
Description: Applications by gismobiledev
Bundle Seed ID: Generate New
Bundle Identifier (App ID Suffix): gismobiledev.*

11. Provisioning -> New Profile.
Profile: RDG_iPhone3GS_Development_Profile
Certificates: “Check the box” next to your name.
App ID: Choose “Applications by GisMobileDev”
Devices: “Tick the boxes for each device that you want to use”

13. After submitting, I noticed the status to be “Pending”. Refresh after a few seconds and the status will change to: “Active until xxxxx”.

14. Download your new provisioning profile.

15. From the Organizer, add the new provisioning profile. Don’t get too excited. You still can’t deploy on the iPhone3GS device. Why? Read on..

16. If you have an existing application that was code signed from a previous profile, we need to tell XCode to use the new provision profile for the new device.

17. XCode -> Open your application -> Project -> Edit Project Settings. Most likely, the Code Signing Identity is still using the old provisioning profile. Where is it?

18. /Users/rupert/Library/MobileDevice/Provisioning Profiles . You can delete the old profile if you don’t need it. Drop the new provisioning profile from here. Afterwards, check again step 17 above. This time around XCode should detect and display the correct profile.

code_sign_error.png

19. What if you have an existing application identifier for the application? Hey, I just created one from the Program Portal, we need to tell XCode to use that identifier! Navigate to your [application]-info.plist and change the Bundle identifier to gismobiledev.${PRODUCT_NAME:rfc1034identifier}. So if you defined “gismobiledev.apps.*” in your Application Id in step 10, then that’s the same string we use in the Bundle Identifier in info.plist.

codesign.png

20. Build and Go. Enjoy!

UPDATE (JAN 07, 2010)
Problem: “codesign ambiguous” error
I am having problems with a “codesign ambiguous” error from XCode. It seems confused because I just added another iphone developer certificate for another company I am working with.

BEFORE:
[1] iPhone Developer: RUPERTO DE GUZMAN
[2] iPhone Developer: RUPERTO DE GUZMAN (89xxxxxxxx)

To resolve this issue, you need to REVOKE [1] above from the PROGRAM PORTAL. After revoking, create a new certificate. Now you should have something like this:

AFTER:
[1] iPhone Developer: RUPERTO DE GUZMAN (EZxxxxxxxx)
[2] iPhone Developer: RUPERTO DE GUZMAN (89xxxxxxxx)

Now, all is good and I don’t have anymore “codesign ambiguous” problems anymore. Note: If you revoke the a certificate, all the developer provisioning profiles associated with the certificate would need to be changed as well. This means most likely you will end up with this process:

step 1: Revoke OLD CERT create NEW CERT
step 2: Create a new DEVELOPER PROVISIONING PROFILE
step 3: Migrate it to the devices.
step 4: BUILD and DEPLOY to devices

When codesigning from XCode, you can now choose from the “PROJECT SETTINGS” which certifcate to use.

CodeSign.png

UPDATE (FEB 26, 2011)
Problem: XCode will not create an IPA archive and will silently fail. Most likely, your development and distribution certificates has just expired. Let’s start clean.

1. Login to http://developer.apple.com/iphone. Go to IOS Provisioning Portal

2. Delete certificates from development and distribution.

3. Generate a new certificate signing request from Keychain.

4. Submit it to the respective Certificates.

5. Download the certificate and install it in Keychain.

certficates'.png

6. Create the necessary provisioning profiles (development and adhoc) and install/dragging it in XCode > Organizer

organizer.png

Normally, you should be able to build both for developer and AdHoc. However, I noticed that when I upgraded XCode, creating an IPA archive just fails silently. Silently? When I click “Save to Disk” nothing happens.

save_to_disk.png

What is the normal behaviour when I click “Save to Disk”? You should see “creating IPA archive” followed by a window/dialog to give a filename for the IPA

Categories: iphone Tags: