Posts tagged with: xcode

Becoming an iOS Developer

I found a nice, straightforward post by Josh Smith about becoming an iOS developer with a background in other technology stacks. He did a great job laying out the basics; I’m not going to really re-hash it, but add my feelings on the matter.

As someone with a background in .NET and Java (among others) I can definitely feel where he’s coming from when he says:

I warn that it will take a considerable amount of time, effort, and patience to get over the learning curve. If you think that going from WinForms to WPF requires a major mental adjustment, you ain’t seen nothin’ yet.

He’s not lying! Through my years of application development experience I’ve become completely comfortable with the whole MVC pattern and many abstract concepts of ‘good’ application design. I’ve found that all (or at least a lot) still apply to the iOS development world, but the execution is so far different than what you’ve done on (probably) any platform that it’d almost be better starting from scratch. Almost… maybe.

I bounce between Visual Studio, Komodo IDE, and Eclipse every day for various languages and products. I use vim, Notepad++, and TextWrangler just about every day (I dual boot Win7 and OS X and bounce between both, all my servers are Linux). Getting used to yet another IDE seemed like a pain, but Xcode 3 was pretty okay. Nothing though, threw me for a loop like the upgrade from Xcode 3 to Xcode 4; with the introduction of segues, moving Interface Builder into the IDE, ARC, and a number of other things. I’m still finding new things every day. It’s a much better IDE than Xcode 3, yet still hasn’t got much in the way of going toe to toe with Visual Studio.

Apple expects developers to be smarter than Microsoft does. Microsoft works hard to ensure that programming technologies are usable by as broad a range of people as possible. Their tooling and documentation assume you aren’t quite sure what you’re doing. Apple, on the other hand, is not nearly as helpful and pandering.

Whether it is that Apple wants to weed out some of those VB6 types, or just assumes that you’ll figure it out- they certainly do a lot less pandering to the least common denominator.

Final Thought

I love developing for iOS. It is a pretty homogeneous environment, Objective C lets me flex some of those C muscles I haven’t flexed in years, I can pretty rapidly get test ideas and wireframes alive enough to experiment with, and it’s another feather in my cap.

If you’re just starting out, turn off ARC, get used to managing memory on your own, and prepare for a lot of initial frustration if you’re used to picking up languages as easy as I have.


Reduce Three20 Compile Time for iOS (Making Static Libraries)

In using Three20 with Xcode 4, I have found life to be a little more difficult than in Xcode 3.

Project changes have required me to fiddle with the project/target compile settings in order to get my project to build correctly, often seeing the dreaded “Three20/Three20.h” file not found error, and not being able to build for archive have all been recurring issues that I’ve faced while developing some pretty simple iOS apps utilizing the Three20 project.

Finally, when the project is building correctly, I spend almost all my compile time building all the Three20 libraries. In search of a better way I stumbled upon a stackoverflow question, and then later on a blog post that have essentially gotten rid of all these hassles for me.

Step 1: How to build any library for all platforms

  • Open an existing static library project.
  • Select the project file on the top, and then select the target you want to build.
  • Go into the Build Phases section
  • Add a new “Run Script” build phase
  • In this phase, paste the following script:

The following code, which was copied directly from the blog post linked above, tells Xcode to compile all the targets for both Device and Simulator. The resulting output will be a .a library file for use in other projects.

Applying this to Three20

  • Go into {Three20 Root Directory}/src/Three20 and open Three20.xcodeproj
  • Select the Three20 target and add the above script into the appropriate build phase
  • Nothing needs to be done to the “Three20UnitTests” target, we won’t be using it for anything.
  • Expand the Dependencies folder for your Three20 project, in the files list on the left side of Xcode
  • Add the same script phase you did before in all of these dependent projects.
  • Do this for every dependency project. If you don’t do this, Xcode will produce all .a libraries, but only the main Three20 library will be created for all devices and they all need to be created for all devices.
  • Once you have added the script build phase to all projects and dependencies, build the project (and be patient).

Giving Due Credit

Had I not stumbled onto Christos Sotiriou‘s blog post I probably could never have figured this out from end to end on my own. He even offers a direct download to compiled libraries and headers if you want to just get up and running.


Three20 and Xcode 4 – How to solve Three20.h not found

Update: 18-Feb-2012

Even after the upgrade I have found that certain builds and project settings were flaky. To improve your build speed and reduce all the configuration hassles of using Three20 and Xcode 4 together, check out my latest blog post on Building Static Libraries

Update: 05-Feb-2012

After upgrading to Three20 1.0.6.2 and following the basic install instructions here, I had no problem building without changing any project settings. Your mileage may vary, however.

I’d still consider myself rather novice to the world of iOS development and the transition from Xcode 3 to Xcode 4 has thrown me for a loop in a few areas. I’ve grown to like storyboards and find Xcode as an IDE to be getting better, but there are some things that drive me nuts. For instance, spending the better part of a day trying to figure out how to get Three20 to work in my project (that was working JUST fine under Xcode 3!).

First!

Follow the instructions provided by Three20 to get yourself oriented with what is going on.

Getting the Build Option to Work:

  • In the Project Navigator view, do the following for each of the Three20 projects (e.g. Three20, Three20Core, etc):
  • Click on the project
  • Go to Build Settings
  • Go to the Deployment section and make sure Skip Install is set to YES for all the configurations (Debug, Internal, Release)
  • Click on the project’s target (under the Targets section) and double check that Skip Install is set to YES for each configuration as well
  • Make sure to repeat these steps in each Three20 project in your project tree

Configuring Build Settings

  • In the Project Navigator view, select your project and then Build Settings
  • Add the two following entries to the Header Search paths and make them the first entries in the list:
    • $(BUILT_PRODUCTS_DIR)/../three20
    • $(BUILT_PRODUCTS_DIR)/../../three20
  • Make sure to set it both in Release and Debug configurations, and that the same build settings appear in your project’s target

Setting the Build Location

Go to Xcode4 Preferences [Cmd + ,] > Locations > Derived Data > Advanced and select Place build products in derived data location.

Clean your project, then build it. Voila.