swemoney.com

  • Random
  • Archive
  • RSS

Adding internationalization to XIB files in Xcode 4

I want to post a quick Derrr post about localizing XIB files in Xcode 4 since I just spent a good 2 or 3 hours trying to figure out what I was doing wrong to find I wasn’t really doing anything wrong.

Localization of your Interface Builder files in Xcode 4 is a piece of cake, actually.

Read More

    • #xcode
    • #apple
    • #ios
    • #iphone
    • #ipad
    • #development
    • #xcode 4
    • #localization
  • 1 year ago
  • 8
  • Comments
  • Permalink
  • Share
    Tweet

NSLog output only when building in Debug Mode

This information can be found quite a few places online but I thought the information was a little scattered, so for my benefit and anyone else who might find this, I thought I’d do a quick and dirty how-to for getting some logging that only shows up when you build your project in debug mode. This is specific to the iPhone but I can’t imagine why you couldn’t re-factor it to work with any Xcode projects.

We’ll start by adding this to your application’s prefix file (should be named MyAppName_Prefix.pch.

#ifdef DEBUG
#define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
#define DLog(...)
#endif
#define ALog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);

Keeping with the quick and dirty thing, basically this just checks to see if DEBUG is defined somewhere and if it is it defines a preprocessor function called DLog(). DLog works just like NSLog() with only 3 exceptions.

  • You can’t do DLog(someVariable);. Instead do DLog(@"%@",someVariable).
  • The PRETTY_FUNCTION stuff adds some extra info about which class and the line number DLog was called from so you can easily find it in your code.
  • You should only see log output while your app is built in Debug Mode.

We also define ALog() which works just like DLog but will always display and isn’t dependent on DEBUG.

Now all we have to do is define DEBUG in our project settings! Head into your Project Settings (Project -> Edit Project Settings) and in the BUILD tab, select Configuration: Debug and Show: Settings Defined At This Level. Add a User-Defined Setting and call it OTHER_CFLAGS. Set it’s value to -DDEBUG=1 and your all set.

Now you should only see any DLog calls when you build in Debug Mode! Like I said, this information is all around the web and I just wanted to kind of condense it all into a quick and dirty tutorial so I didn’t want to go into too much detail. If you want more information about how this is done, you check here and here for ALL the information I have here in much more detail. All the credit for the information here goes to those 2 posts.

    • #iphone
    • #apple
    • #xcode
    • #tips
    • #code
  • 3 years ago
  • 1
  • Comments
  • Permalink
  • Share
    Tweet

iPhone OS/SDK 3.0 Beta 2 released

Downloading Beta 2 of the iPhone 3.0 OS. A change log can be seen for those interested. /me hopes this resolves some of the really annoying bugs.

    • #iphone
    • #apple
    • #xcode
    • #iphone 3.0
  • 3 years ago
  • Comments
  • Permalink
  • Share
    Tweet

Cocos2D-iPhone Xcode Template

I’m still researching how to get started with some game development on the iPhone and one of the articles I came across was a short tutorial detailing how to setup and start an application/game on the iPhone using the free cocos2d-iphone engine. Being the anal person I am, I couldn’t just refer to the article every time I wanted to start a new project, so I decided to research how to put together my own template for Xcode that would do all the dirty work necessary automatically. It turns out it’s quite easy to put together an Xcode template and what kind of good natured developer would I be if I didn’t share with the rest of the world?? I went ahead and created a new git repository with the template. To grab it, go ahead and follow these quick instructions..

cd /Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Project\ Templates/Application
git clone git://github.com/swemoney/xcode_cocos2d_iphone_app_template.git Cocos2D\ Based\ Application\ \(0.6.x\)

Do that in any terminal and next time you start up xcode and try and create a new project, you should see a Cocos2D-Based Application options there that will give you the basic starting blocks for using the cocos2d engine.. Enjoy!

UPDATE: Now includes version 0.6.3 of Cocos2d-iphone as well as a menu scene.

    • #iphone
    • #cocos2d
    • #xcode
    • #apple
    • #game dev
    • #code
    • #My Stuff
  • 3 years ago
  • 4
  • Comments
  • Permalink
  • Share
    Tweet
iOS application development, video games, random thoughts, apple. These are a few of the wonderful things you'll catch on my blog.

Pages

  • Projects
  • Apps
  • Secret Browser

Elsewhere

  • @swemoney on Twitter
  • Facebook Profile
  • tehdnite on Youtube
  • dnite on Digg
  • swemoney on Rdio
  • swemoney on github

Twitter

loading tweets…

  • RSS
  • Random
  • Archive
  • Mobile

Effector Theme by Carlo Franco.

Powered by Tumblr