How to add Three20 into your project

  • Source: Download the Three20 source.
  • Three20 is compiled as a static library and the easiest way to add it to your project is to use Xcode’s “dependent project” facilities. Here’s how:
  • Clone the Three20 git repository:
    git clone git://github.com/facebook/three20.git
  • Locate the “Three20.xcodeproj” file under “Three20/src”. Drag Three20.xcodeproj and drop it onto the root of your Xcode project’s “Groups and Files” sidebar. A dialog will appear — make sure “Copy items” is unchecked and “Reference Type” is “Relative to Project” before clicking “Add”.
  • Now you need to link the Three20 static library to your project. Click the “Three20.xcodeproj” item that has just been added to the sidebar. Under the “Details” table, you will see a single item: libThree20.a. Check the checkbox on the far right of libThree20.a.

  • Now you need to add Three20 as a dependency of your project, so Xcode compiles it whenever you compile your project. Expand the “Targets” section of the sidebar and double-click your application’s target. Under the “General” tab you will see a “Direct Dependencies” section. Click the “+” button, select “Three20”, and click “Add Target”.

  • Now you need to add the bundle of images and strings to your app. Locate “Three20.bundle” under “Three20/src” and drag and drop it into your project. A dialog will appear — make sure “Create Folder References” is selected, “Copy items” is unchecked, and “Reference Type” is “Relative to Project” before clicking “Add”.

  • Now you need to add the Core Animation framework to your project. Right click on the “Frameworks” group in your project (or equivalent) and select Add > Existing Frameworks. Then locate QuartzCore.framework and add it to the project.
  • Finally, we need to tell your project where to find the Three20 headers. Open your “Project Settings” and go to the “Build” tab. Be sure to select the appropriate active configuration (eg, Release vs. Debug — eventually you’ll need to change both). Look for “Header Search Paths” and double-click it. Add the relative path from your project’s directory to the “Three20/src” directory. If your project and the Three20 source are in the same parent, you would enter “../Three20/src”.
  • While you are in Project Settings, go to “Other Linker Flags” under the “Linker” section, and add “-ObjC” and “-all_load” to the list of flags.
  • You’re ready to go. Just #import “Three20/Three20.h” anywhere you want to use Three20 classes in your project.

!! Enjoy !!

This entry was posted in iOS by Muzammil. Bookmark the permalink.

About Muzammil

Hey Guys, I am Muzammil Mohammad. Having 7 years of experience in iOS development. I am here to share my knowledge with all mobile application developers and those companies who are stuck on development (due to bad quality of code or don't know what to do) or want to know how to build a good mobile app. I believe I am more expert in UI and Architecture design of mobile app. So if you need my helps or assistant for your mobile app projects, Feel free to contact me. I will try my best to improve the quality of your app. Or you can hire me to develop your apps. I’d love to talk with you. Best!

17 thoughts on “How to add Three20 into your project

  1. hi,
    i have done all the above steps, but at final when i import the “Three20/Three20.h” file in a class file its showing the error that “Three20/Three20.h” no such file or directory…..can u please help me….?

      • I had some troubles with your sripct so I wrote a new one. Maybe this will helps someone out there:#!/usr/bin/perl -wuse FileHandle;use File::Temp ( mkdtemp );use File::Copy ( copy );use File::Basename ( basename );use Cwd ( chdir );my $filename = basename( %%%{PBXFilePath}%%% );my $temporary_directory = mkdtemp( /tmp/uncrustifyXXXX );my $uncrustify = /Applications/UniversalIndentGUI/indenters/uncrustify ;my $config = /Applications/UniversalIndentGUI/myIndenters/p31Indenter.cfg ;# Write out the file to a temp directoryopen(OUTFILE, > $temporary_directory/uncrustifyMe.m ) or die Unable to create temporary file: $! ;print OUTFILE while();close(OUTFILE);chdir( $temporary_directory );# Write to temp first then read in file and print itmy $output = `$uncrustify -c $config -o output.m -f uncrustifyMe.m`;# Read in fileopen FILE, < output.m ;$file_contents = do { local $/; };# Clean upunlink uncrustifyMe.m ;unlink output.m ;rmdir $temporary_directory ;print $file_contents;

      • This tutorial is great. Thank you. My prebolm is that when I post the website onto my web account it does not work. The site shows up and shows the title and the date but does not show the RSS news feed items. When I run the webpage directly from Dash Code to the iPhone Simulator the RSS news feed items show up but once I upload the entire folder to my web host and visit the site the RSS news feed items just do not show up. I know that the RSS news feed is working so I have no idea what to do.Please advise me ASAP. I need help with this!Thank You,John

        • Hi Nathan,I’ve got to the stage where you download PhoneGap. I’ve doewoladnd the latest version and have run this program in the iPhone folder: PhoneGap.xcodeproj .The one you mentioned is not there in the latest release. However, there is no sign of the url.txt in the folder. Any ideas? I think I should get it working ok if I can find the file (or its new equivalent!). Any help appreciated. Thanks. John

    • Question (dumb one): I’ve written some simlpe calculator programs using dashcode (haven’t moved them to my ipod though I will try it out with this tutorial). When I test them in the iphone simulator the web address bar appears at the top (it’s opening the app with safari or course).When I put that app on my ipod or put it in the app store will that address bar still be there? I assumed not but I would rather be safe than sorry.Thanks,~Jason

  2. 1. Compile your Three20 (sample code) and make sure it works fine.

    2. Avoid putting your project and Three20 on desktop.

    3. Path of your project:
    /Volumes/Projects/Muzammil Projects/myThree20Project (inside this you folder of your project name which .xcodeproj file)

    Path of your Three20 Library:
    /Volumes/Projects/Muzammil Projects/myThree20Project (inside this you have folder of name “three20) inside this you have 2 more folder of name “sample” and “src” and inside “src” you have Three20.xcodeproj file)

  3. Thank you for your help sir….but what should be the header search path should be?
    I have given this….still the same error /Projects/Three20Project/Three20

    • Thomas-I have been playing with UniversalIndentGUI and it does make teisntg settings really easy.My biggest problem is the way it handles spaces around colons. The same config that adds or removes spaces to make 1 space before and after colon in this line:[UIView setAnimationDelegate : self];Ignores the spacing around the colons in this line:if (self = [super initWithNibName:nibNameOrNil bundle: nibBundleOrNil])I’ve tried playing with the sp_after_send_oc_colon and sp_before_send_oc_colon parameters but they don’t seem to do anything.Overall I’m happy enough with it as it is. The problems are minor and don’t prevent anything from compiling. It’s still 100x better than just using the built in re-indent.

  4. the Three20.xcodeproj is not in src folder…inside src there is another folder Three20 inside that the xcodeproj file is present.

    • Naaaah is a waste of time (2-3 of my hours)Is not as simple as is peseentrd, I manage to get the blog feed in a safari and mobile versions (the part of linking to the feed/test/deploy is not that clear).I could try to explain but I’m just starting and will provably be more confusing.The Phone gap is much worst peseentrd, confusing and difficult that the article pretends!I suppose for a newby like me just plain impossible so don’t even try unless you plan to study slow the phonegap thing.An update would be great!Rob

  5. Pingback: How to add Three20 into your project | Advanced App Development

    • Marc no, unfortunately. Apple miintaans strict control of how native applications are deployed. While it is possible to do an enterprise deployment of an application through downloading of a file from a website, you still have to use iTunes to install the file onto your device. Over the air installation is only allowed via the iTunes App Store.What I meant in the post, is that you can view the iPhone-compatible web content created from the Dashcode application. You can also bookmark the site and add the bookmark shortcut icon to the iPhone launcher/finder. Check out the Dashcode app, and you will see what I mean.Thanks for the comment!

Leave a Reply to Millioner Cancel reply

Your email address will not be published. Required fields are marked *