Archive for the ‘development’ Category:

Iphone OS 3.0 Beta

March 18th, 2009

iPhone 3G

I’m totally excited. Yesterday Apple announced the newest version of the iPhone OS, 3.0, to be available in June 2009 to both iPhones (original and 3G), and iPod Touch (1st and 2nd generation).  For those building iPhone apps, the beta version of 3.0 SDK is available now.  That means developers can actually start playing with 3.0 TODAY.

Here’s my favs from what’s new in 3.0

  • Cut, Copy, and Paste (finally)
  • Send photos, contacts, audio files, and location via MMS (iPhone 3G only)
  • Push Notification Service
  • In App Purchase Support
  • Peer to Peer Support
  • Maps API
  • Audio and Video Enhancements

I’m glad to see cut’n’paste is gonna finally work.  So many times I want to copy a URL from a text or email to Safari, or copy an address to google maps.  However, I’m really pissed that MMS (send a picture message) is only for iPhone 3G.  Back in 2005 I was using my cell phone to send pictures AND VIDEO to my friends phones.  2 years later I bought the iPhone, and now I still can’t do it.  As a phone, iPhone kinda sux.  But as the most awesome portable touchscreen internet customizable high quality audio and video playback device, iPhone rules.

I like the “Push Notification Service” because it allows custom iPhone apps to do receive messages from the internet even if they are not running.  For example, when you get a SMS Text message, an alert pops up on the iPhone with the text message, which you can close or reply, launching the Text Messaging app.  Similarly, the new push service allows an alert to pop up for a custom app.   However, if user hits close the alert goes away and the app is not run.   That means that background processing is still not allowed.  Another way to view it is:  Internet –>  iphone –> Human –> iphone app.  I much prefer this view:  Internet –>  iphone –> iphone app.  Skip that human interactive component and let the app process a notification as it sees fit.   NOTE: originally I thought 3.0 would allow background processing, but 3.0 beta SDK corrected me.

If you want to make money, the “In App Purchase Support” is huge.  You can make an app cost $0.99 in iTunes, offering some basic functionality at a low price point for mass adoption.  Then offer premium services for an additional $1.99 (or whatever) right there in the app – it does not get easier.  Perfect for games (download the next 10 levels for $1.99) or for monthly services ($5.99 for next months premium financial or sports information).

Peer to Peer Support is cool because it makes it easier for iPhones to talk to each other (or other devices that support apple’s bonjour protocol).  Examples include games (just like online multiplayer playstation games), exchanging virtual business cards, or sharing documents.

Maps API has a lot of potential, especially since its closely intergrated with Google Maps API (terms).  Combined with location aware (GPS or cell tower triangulation) phones, this makes it much easier for apps to have custom annotations displayed near the user’s location.  You can also do some of this in safari, skipping the iPhone app and just makeing a website page specific for iPhones (the new safari in 3.0 allows javascript to know users location).

Audio and Video have also been updated.  With iPod Library Access, an app can play any song on the phone. One example would be a game tied to a specific playlist, where each game event (begin, score, foul, goodbye) is mapped to a song, allowing users to customize the audio themselves.  Video Streaming is improved – now you can playback video streamed from a standard HTTP (Web) Server.  Expect more websites to have a feed made for mobile devices. Core Audio and Audio Recording got newer engines under the hood, including support for more codecs and software decoding.

First iPhone App In One Day

January 4th, 2009

I was actually surprised by how easy it was to create my first iPhone app – From launching Xcode for the first time, building an application on the simulator, to paying $99 so i can legally put apps on my iPhone, and getting my app to run on my iPhone – all in one day.

The following is a summary of how to create your first app using iPhone OS 2.2 and the iPhone SDK available in December, 2008.  I write this blog since documentation can become out of date very fast (ahem, apple).

First, this is what you will need

  • Intel Mac with OS X 10.5.5 or later (I used 10.5.6)
  • iPhone SDK for iPhone OS 2.2 (I had build 9M2621)
  • iPhone with OS 2.2
  • $99 if you want to run your app on your iPhone – its free to develop and run on the iPhone simulator that comes with XCode

How to create a simple “Hello World” app on your iPhone

  1. Login to iPhone Dev Center
  2. Download and install iPhone SDK if you have not – its 1.56 GB (HUGE, may take more than a day to download).  It comes with XCode 3.1.2 and everything you need for iphone development.
  3. Follow this 6 minute Hello World video.  Note: after a minute he launches Interface Builder – one of the windows does not launch by default, launch it from – Tools – Identity Inspector
  4. Done with free section – Hello World on Simulator
  5. Pay $99 to join the iPhone Developer Program – lets you install apps on 100 devices (iPhone, iPod Touch)
  6. Once you’ve paid, download the “Program portal user guide” (right side, near top) from the iPhone Developer Program Portal, (links will not work unless you login and are in the program).
  7. Follow the instructions in the user guide (version 2.4 is what I had).  It is mostly accurate (getting certificates, etc) up to section called “Installing iPhone OS” (pg 18) where it says

    To run your code on an Apple device, you will need to install iPhone OS onto each development device and “restore” each device to a development state. Note: Once a pre-release version of iPhone OS is installed on the device you cannot restore the device to an earlier version of iPhone OS. The device may only be used for development and testing purposes until that version of iPhone OS is publicly released. Please DO NOT install the iPhone OS before registering device UDIDs, as installation on non-registered devices will render them inoperable. The public release version of iPhone OS should be installed using iTunes.


    1) Download the iPhone OS Disk Image (.dmg) from the iPhone Dev Center for the Apple device you are using.
    2) Connect your device to your Mac, close iTunes and launch Xcode.
    3) Once the device is detected by Xcode, select ‘Use for Development’ when prompted.

    • Ignore.  You do not need to download or install anything special for development if you have the regular retail version 2.2 on your iPhone (normally installed using iTunes).  I assume these instructions were for 2.1 or 2.0 or earlier.
    • Just backup iPhone on iTunes, close iTunes, launch XCode, go to Window – Organizer,
      click on your iPhone, click “use for development” under summary tab. That’s it.
  8. Continue with guide, create App ID (when choosing your “Bundle Identifier”, I recommend using asterisk like: com.mysite.*), install profile, etc.
  9. If you follow the guide exactly, you will see this error when you try to install app on your device (aka iPhone)

    Your mobile device has encountered an unexpected error (0xE800003A)

  10. Here’s how you fix the above
    • You must create entitlements.plist – On you XCode Project, goto File->New File…->iPhone OS -> Code Signing ->Entitlements.  Just name new file “entitlements.plist” (it should be created in your project directory).
    • Goto Build Info (on your main project window in XCode, right under “Groups & Files” click on project name at top, then click the big Info Icon at the top middle). Under “Build” section, look for “Code Signing Entitlements” – the Value is probably blank – double click, in the popup window type in the new file name “entitlements.plist”
    • Under Target Info (on your main project window in XCode, under “Groups & Files” Targets list click on project target name, then click the big Info Icon at the top middle). Under “Properties” section, change “Identifier:” from to the “Bundle Identifier” you created  on the program portal website under App IDs – do not include the ten character “Bundle Seed ID” prefix, just the “Bundle Identifier” you picked. ex: com.chadnorwood.${PRODUCT_NAME:identifier}
  11. DONE.  You should now be able to create new projects and more apps.


WordPress Theme: Inove

December 2nd, 2008

As mentioned in my previous post, I upgraded wordpress and am using the Inove theme. I chose it because it looks clean and has basic functionality (most wordpress themes do not). When I say clean, I mean I like the use of black, white, and grey colors, I like the fonts, I like having posts be black on white with the background of the page being grey (anything but white, helps focus attention to the posts). I also like the simple search box in the header, I like the small simple icons like green dots for lists, calendar icon, categories icon, tags icon, comments icon, etc. I like how how tables are done, pre format is done, and a few other things.  However, it is not perfect for me.  So …

Things I changed included

  1. Fixing bug where tag icon appears even if a post has no tag
  2. Moving categories and tags to the top of posts – I prefer having all the meta information in one place.
  3. Moving RSS code from top of sidebar.php to bottom
  4. Removing non-widget code from sidebar.php – If a widget is not chosen for N, S, E, W, defaults are shown like archives and categories.  I don’t want 2 categories, as esserd said. If I want something, I will use widgets.
  5. Tweaked styles.css to add padding to bottom of lists (.post .content ul,   .post .content ol)
  6. Changed header on search results and archive (tags, categories) from 2 lines to 1 line.

Overall great theme.  Thanks mg12!!!  Also, check inove forum for other issues.
UPDATE: You can find my changes in inove-1.0.5.diff.tgz, preview the readme or diff.

WordPress Update

December 2nd, 2008

Geek Warning…

I’ve been wanting to update for a while, so over the weekend I upgraded wordpress from version 2.3.x to 2.6.3 and picked out a new theme.  First I did a wordpress export of my blog as a backup.  Then the upgrade was done using hostmonster’s fantastico deluxe, an automated installing system in cpanel.  Some don’t like fantastico, but it took me 10 seconds to do the upgrade with no problems.  Success.

After the upgrade it took me almost 4 hours to figure out why my category links were broken.  WTF? Basically under 2.3 I had my permalinks setup so if the URL was wordpress would show posts under the tech category.  So I upgrade to 2.6, and Settings-Permalinks show “tag” as the “Category Base” but /tag/travel is broken – no longer works in 2.6.  Of course I didn’t think about changing this till I examined the mysql database tables, dug through thousands of lines of terrible wordpress code, and googled every phrase combination related to this I could think of.  In the end, I reverted back to the basics and it all worked.  I still had to resolve the 404 issue of the old tag links, which I did using template_redirect.

Picking the theme took even longer – but that was more fun.  I basically viewed about 50 of the most popular wordpress themes, downloaded and installed 10 of them, activating one at a time and testing them for functionality and style.  Only 4 seem to have all the basic functionality working correctly, and even tho I liked the wood in State of Mind, I went with the Inove theme. Inove is more clean and shayna thought the wood one was too academic.  I also tweaked Inove .. but thats in the next post.

Overall the wordpress 2.6 is not much different.  The admin pages look cleaner and are better organized for the most part, but the db has changed and some stuff is broken so I would only recommend upgrading if there was a specific theme or plugin that needs 2.6.  I really love the plugins and themes – the number of great choices makes wordpress much better than all the other blogging platforms. It’s not perfect, and the documentation could improve alot, but these wordpress guys are still actively working on making a better blogging software which is a very good thing.

WordPress: template_redirect

December 2nd, 2008

Before I upgraded to wordpress 2.6, I had URLs using tags like this:

After I upgraded I realized I liked categories better (they can have parent categories).  So no more tags, all categories, but the problem was that google (and others) still link to /tag/travel/ which ended on a 404 page. Since I had no tags, I decided to redirect all my  /tag/xxxx to /cat/xxxx – I also prefer /cat/xxx to /category/xxx, which I changed in Settings-Permalinks.  Here’s how I did the redirect exactly:

Add the following to the end of ../wp-content/themes/<current_theme>/functions.php file

// added at the end of functions.php file, in my current theme's directory
add_action ('template_redirect', 'check_for_tag_404');

// custom function to redirect old tag links to new cat links
function check_for_tag_404()
$pat = '/^\/tag\/(.*)$/';

// return if this URL does not begin with "/tag/"
if (!preg_match( $pat, $_SERVER["REQUEST_URI"])) return;

$uri = preg_replace( $pat, '/cat/$1', $uri);
$location = "http://" . $_SERVER["HTTP_HOST"] .  $uri;
header("Location: $location");

Big Ups to this template_redirect dude for giving me a clue.