RSS Feed

Category Archives: IPhone Tricks

How to add Three20 into your project

Posted on
  • 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 !!

Advertisements

Use Relative Paths When Adding Frameworks

Posted on

When you add a framework to your project in Xcode, make sure you use Path Type = “Relative to Current SDK”. There is no option for this when you add the framework. So after the framework has been added to your project, command-click on the framework and select Get Info.

Your paths should look something like this:
System/Library/Frameworks/AudioToolbox.f

ramework

Why is this important?

When you start developing using both the iPhone simulator and an actual iPhone device you technically switch SDK based on your target. And it’s a real pain to have to adjust all the framework paths each time.

How to change simulator

Posted on

I just downloaded a project from web and i got following error-

There is no sdk with specified name or path “iPhoneos3.1…”. (you may got error according to your Xcode version)

Here is the solution:

1. Select the main project file in xcode (main sheet which is the name of your project under the groups and files column to the left-top of your project).

2. Then select the info button (blue circled “I” next to build and go).

3. Go to the build panel and under the archetectures section go to the base sdk category and select iphone simulator according to your current Xcode version and close.

4. Close your project window.

5. Reopen the project Build and Go……

!!! Enjoy !!!