Archive

Archive for August, 2009

iPhone Note #4: Upgrading iPhoneSDK3.1.3 and iPhoneOS Device

August 4th, 2009 rupert Comments off

Apple has been releasing incremental betas in a short span of time. The ff steps would help me in documenting how to upgrade the SDK and iPhoneOS.

Part 1: iPhone SDK

1. For upgrading, we are going to choose “Custom install” into a directory “XCode3.1.3″ which I installed a few weeks ago. If you don’t change this, it will be installed in a default directory “Developer”.

Picture 2.png

Read more…

Categories: iphone Tags:

TextMate CheatSheet (Updated)

August 2nd, 2009 rupert Comments off

Shortcuts

Ruby:
---------------------------------
:key => "value" - : + tab
 
Navigate:
---------------------------------
go to file - cmd - t
tab to file (left|right) - opt + cmd + (left arrow|right arrow)
select bundle item - ctrl + cmd + t
navigate (from controller to view) - opt + cmd + down arrow
show methods - shift + cmd + t
 
Views:
---------------------------------
create partial - ctrl + shift + H
render partial (object|collection|locals) - r + p + (o|c|l)
inserting an erb tag <%=  %> or <% %> - ctrl + shift + . (cycle)
code completion, <h3>foo</h3> - opt + cmd + .
 
2RMobile Snippets:
---------------------------------
<% objects.each do |object| %>		2rmloope
	<%= object. %>
<% end %>

* Make the project drawer appear on the left or right.

From the menubar select View, then Hide Project Drawer.

Move your TextMate editor window over to the left side of the screen so the project gutter won’t have enough room to open up on that side. (You can move the window all the way to the left if you want, but you don’t need to go that far.)

Select View, then Show Project Drawer, and the drawer will now open on the right side of your TextMate editor.

* Plugins directory is located at

1. /Applications/TextMate.app/Contents/PlugIns/
2. /Users/rupert/Library/Application Support/

http://manual.macromates.com/en/bundles#support_folder

* Installing a bundle.
RubyOnRails Bundle: https://github.com/drnic/ruby-on-rails-tmbundle
RSpec Bundle: https://github.com/rspec/rspec-tmbundle
Cucumber Bundle: https://github.com/aslakhellesoy/cucumber-tmbundle

mkdir -p ~/Library/Application\ Support/TextMate/Bundles
cd ~/Library/Application\ Support/TextMate/Bundles
git clone git://github.com/drnic/ruby-on-rails-tmbundle.git "Ruby on Rails.tmbundle"

Launch TextMate > Bundles > Bundle Editor > “Reload Bundles”

* Identify *.html.erb to open in HTML(Rails)
Read http://blog.macromates.com/2007/file-type-detection-rspec-rails/

rupert:blog rupert$ defaults read com.macromates.textmate OakLanguageFileBindings
(
        {
        fileTypes =         (
            txt
        );
        language = "17994EC8-6B1D-11D9-AC3A-000D93589AF6";
        name = HTML;
    },
        {
        fileTypes =         (
            builder,
            rb,
            erb
        );
        language = "54D6E91E-8F31-11D9-90C5-0011242E4184";
        name = "Ruby on Rails";
    }
)
rupert:blog rupert$ defaults delete com.macromates.textmate OakLanguageFileBindings

* Identify Gemfiles in TextMate for Ruby on Rails
Read http://efreedom.com/Question/1-3174451/Bundler-Gemfile-Syntax-Highlight-Text-Mate

Include the ‘Gemfile’ as a filetype

fileTypes = ( 'rb', 'rxml', 'builder', 'Gemfile' );

* Soft Tabs and Spaces in TextMate
To turn on soft tabs (bottom of the window, in the tab size selector). This will insert spaces instead of tabs, so there won’t be anything to convert when it’s time to save
Source: http://old.nabble.com/Convert-tabs-to-spaces-when-saving–td28891731.html

Categories: osx, rails, ruby Tags: , ,

iPhone Note #2: Memory Management

August 2nd, 2009 rupert Comments off

1. If its alloc, copy, new. YOU ARE RESPONSIBLE for RELEASING the OBJECT (YARRO).

NSString *en_name = [[NSString alloc] initWithUTF8String:(char *)sqlite3_column_text(statement, 1)];

//do something.. set it to an object..
poi.en_name = en_name;

[en_name release];

Read more…

Categories: iphone Tags:

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: