Saturday, April 4, 2009

Launching 3rd party apps within iPhone from your apps

It is possible to launch other applications on the iPhone that are very useful to perform features beyond your application. E.g. you don't need to embed browser object within your app to show your web page to users... just invoke in-built browser using http: for the needful. Similarly mailto: for the mail, and tel: for calling etc.

Here is some sample code/info on how to launch other apps within an iPhone through your own customized app:
  • Launch the Browser
  • Google Maps
  • Launch Apple Mail
  • Dial a Phone Number
  • Launch the SMS Application
  • Launch the Browser
  • Launch the AppStore

Launch the Browser
NSURL *url = [NSURL URLWithString:@"http://www.inavdeep.com"];
[[UIApplication sharedApplication] openURL:url];

Launch Google Maps
// Create your query ...
NSString* searchQuery = @"1 Infinite Loop, Cupertino, CA 95014";

// Be careful to always URL encode things like spaces and other symbols that aren't URL friendly
searchQuery = [addressText stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];

// Now create the URL string ...
NSString* urlString = [NSString stringWithFormat:@"http://maps.google.com/maps?q=%@", searchQuery];

// An the final magic ... openURL!
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlText]];

Launch Apple Mail
mailto://${EMAIL_ADDRESS}

For example, here we are opening the email application and filling the “to:” address with contact@me.com :

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"mailto://contact@me.com"]];

Dial a Phone Number
tel://${PHONE_NUMBER}

Here is an example of how we would dial the number (800) 867-5309:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://8001231234"]];

Launch the SMS Application
sms:${PHONENUMBER_OR_SHORTCODE}

NOTE: Unlike other URLs, an SMS url doesn’t use the “//” syntax. If you add these it will assume it is part of the phone number which is not.

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms:55555"]];

Launch the AppStore
http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=291586600&mt=8

Launching the AppStore URL is exactly the same as you would launch the browser. Using the link above, here is an example of how we would launch the AppStore:

NSURL *appStoreUrl = [NSURL URLWithString:@"http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=291586600&mt=8"];
[[UIApplication sharedApplication] openURL:appStoreUrl];
Finally, it is worth noting that you can launch another app from your customized app within same iPhone!

Tuesday, March 31, 2009

Skype for the iPhone is out now!

Just installed an official Skype app on my iPhone 3G through AppStore. The app looks awesome with excellent user experience. It was intelligently designed by keeping usual iPhone habits into consideration, very easy to use, full featured VoIP application.

I liked it a lot even when I am getting crash of app every 2 minutes. I know it will be stable very soon now. Definitely this is one of the most waited app for iPhone platform.

Few good factors:
1. Maintains calls & chats history within iPhone for faster look back
2. You don't need to login everytime you launch it
3. Automatically logs out upon quitting app. Good for battery backup.
4. Can make calls to mobile/landlines using SkypeOut.
5. Best - Make free calls over VoIP using expensive handset :)
6. Yet to test, but it supports conference calls

Skype have finally done it! And it was worth to wait.

Monday, March 30, 2009

Mac OS X keyboard shortcuts

Start up hot-keys (press key while booting)

X = Force Mac OS X startup
C = Start up from a bootable CD
N = Attempt to start up from a compatible network server (NetBoot)
T = Start up in FireWire Target Disk mode
Opt-Cmd-Shift-Delete = Seeks a different startup volume
Shift = Start up in Safe Boot mode
Cmd-V = Start up in Verbose mode
Cmd-S = Start up in Single-User mode

Cmd-Opt-Esc = Force Quit menu
Cmd-Opt-D = Show/hide the dock
Ctrl-Eject = Bring up Shutdown/Sleep/Logout Dialog
Ctrl-Cmd-Eject = Restart immediately

Clipboard

Cmd-C = Copy
Cmd-V = Paste
Cmd-X = Cut
Cmd-A = Select All

Finder Navigation

Cmd-N = New Finder window
Cmd-W = Close Window
Opt-Cmd-W = Close all Windows
Cmd-Down = Open File/Folder
Cmd-Up = Navigate to parent
Cmd-Right = Expand folder (in list view)
Cmd-Left = Collapse Folder (in list view)
Opt-Cmd-Right = Expand folder and its subfolders (in list view)
Opt-Cmd-Up = Open parent folder and close current window
Cmd-Shift-H = Jump to your Home folder
Cmd-Shift-A = Jump to your Applications folder
Cmd-Shift U = Jump to your Utilities folder
Cmd-Shift K = Jump to the Network browser
Cmd-Shift G = Goto Folder…
Cmd-1 = View as Icons
Cmd-2 = View as List
Cmd-3 = View as Columns
Cmd-Space = Open Spotlight (OS X 10.4)
Cmd-Delete = Move file/folder to trash
Cmd-Click window title = Display the file path

Menu Commands

Shift-Cmd-Q = Log out
Shift-Opt-Cmd-Q = Log out immediately
Shift-Cmd-Delete = Empty Trash
Opt-Shift-Cmd-Delete = Empty Trash without dialog
Cmd-H = Hide window
Opt-Cmd-H = Hide Others
Cmd-N = File New window
Shift-Cmd-N = New Folder
Cmd-O = Open
Cmd-S = Save
Shift-Cmd-S = Save as
Cmd-P = Print
Cmd-W = Close Window
Opt-Cmd-W = Close all Windows
Cmd-I = Get Info
Opt-Cmd-I = Show Attributes Inspector
Cmd-D = Duplicate
Cmd-L = Make Alias
Cmd-R = Show original
Cmd-T = Add to Favorites
Cmd-Delete = Move to Trash
Cmd-E = Eject
Cmd-F = Find
Cmd-Z = Undo
Cmd-B = Hide Toolbar
Cmd-J = Show View Opts
Cmd = [ = Go Back
Cmd = ] = Go Forward
Shift-Cmd-C = Go to Computer
Shift-Cmd-H = Go to your Home folder
Shift-Cmd-I = Go to iDisk
Shift-Cmd-A = Go to Applications folder
Shift-Cmd-G = Go to Go-To Folder
Cmd-K = Connect to Server
Cmd-M = Minimize Window
Cmd-? = Open Mac Help
Cmd-Space = Open Spotlight (OS X 10.4)

Screen capture

Cmd-Shift 3 = Capture the screen to a file
Cmd Ctrl Shift 3 = Capture the screen to the clipboard
Cmd-Shift 4 = Select an area to be captured to a file
Cmd Ctrl Shift 4 = Select an area to be captured to the clipboard
Cmd-Shift 4, then press Space = Capture entire window

Universal Access

Opt-Cmd-* (asterisk) = Turn on Zoom
Opt-Cmd-+ (plus) = Zoom in
Opt-Cmd– (minus) = Zoom out
Cmd-Opt-Ctrl-8 = Invert Screen colours

Window Management

Cmd-W = Close window
Cmd-Opt-W = Close all windows
Cmd-M = Minimise window
Cmd-Opt-M = Minimise all windows
Cmd-H = Hide Application
Cmd-~ = Cycle through windows for current application
Ctrl-F4 = Cycle through every open window
Cmd-Tab = Bring up the Application Switcher.
Cmd-Tab = Cycle Forwards
Cmd-~ = Cycle Backwards
Cmd-Shift-Tab = Cycle Backwards
Cmd-Q = Quit application

Expose

F9 = Show all open windows on the screen at once
F10 = Show all windows for the current application.
F11 = Shows Desktop
F12 = Activates Dashboard
F12 (hold) = ejects disk

Miscellaneous

Opt-Cmd-D = Show/Hide Dock
Ctrl-Up = Move up one page
Ctrl-Down = Move down one page
Opt-Drag = Copy to new location
Opt-Cmd-Drag = Make alias in new location
Cmd-Drag = Move to new location without copying
Opt-Cmd-Eject = Sleep
Cmd-click window toolbar button (upper right corner) = Cycle through toolbar views
Ctrl-Cmd-D and mouse over word in Cocoa applications = shows Dictionary description for that word

iPhone dev: ibtool failed with exit code 5

A dirty error was occuring while I was compiling an iPhone app to deploy in my iPhone v2.2.1. I thought I need to go back to developer mode to fix this, but luckily I found a quick solution to this which was fairly simple than anything else in Cocoa coding. I would definitely want to share this with you coz it looks quite common error to me. Likely to be an Xcode bug too:

Error description, "Command /Developer/usr/bin/ibtool failed with exit code 5"

Clue: UITextFields can’t be set to Hidden !!!

The solution is: You probably have a UITextField set to hidden in one of your Nib files… Unhiding the UITextField will solve the problem.

Enjoy!