BetaDesigns( Blog ) Flex and Component Development

23Dec/110

Getting Static Libraries to link correctly in XCode workspaces

I just answered a question on StackOverflow about how to fix dependency issues in xcode workspaces when linking static libraries. This is just a post to remind myself.

StackOverflow Post

On A side note if the files within the library are only to be used in Storyboards then you need to explicitly reference them otherwise the compiler will remove them and you will get Run time errors.

The easiest way to do this is to create a Class with the same name as the library and each file you want to force for inclusion you should do the following.

 
 
-(id) init
{
    [CustomClass1 class];
    [CustomClass2 class];
    etc....
}
 

Then inside your main application

 
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    //Force inclusion of files.
    [CustomLibrary class];
    return YES;
}
 
12Nov/110

XCode localization Reminder.

Just a quick reminder for myself for creating localization files in the terminal for xcode projects.

cd to project directory.

find . -name \*.m | xargs genstrings -o en.lproj

The above will find all .m files in all subdirectories and extract the NSLocalizedString().

30Oct/110

Native Extensions 101

I have just release a blog post about creating a NativeAlert extension for AIR. It includes multiple buttons and dispatches ActionScript events when the user selects one of those buttons.
the post can be found here.

http://www.liquid-photo.com/2011/10/28/native-extension-for-adobe-air-and-ios-101/

The source is on github and you can download the NativeAlert.ane file directly also

10Jul/100

Useful Xcode breakpoints for debugging

Just a quick list of the most useful breakpoints I have found for debugging purposes. This is more of a personal reference so that I can add them back to any new install of Xcode.

objc_exception_throw
[NSException raise]
malloc_error_break

In addition here is a great tech paper on debugging in xcode called Mac OS X Debugging Magic

And here is a nice tutorial for using instruments to debug

3Feb/102

Custom Eclipse Style XCode shortcuts

After using eclipse for so long i have become a custom to my shortcuts and xcode just doesn't stand up to the job as far as i am concerned so here is a small list of the custom key bindings i have setup for myself. I will add more as I create them.

To create a custom key bindings file goto XCode>Preferences>Bindings> Duplicate an existing binding and name it whatever you want then go to and open the file you just created in a text editor so you can see the xml output.

~/Library/Application Support/Xcode/Key Bindings/*.pbxkeys

A good list of available commands can be found here

1. Duplicate code!

I can't believe xcode doesn't have this in Eclipse you simple select your text and press Ctrl + Alt and either Up or Down on the keypad and it will duplicate your code placing it either above or below the current selection. It will also reselect the newly duplicated code so that you can duplicate it as many times as you like.

<key>^~\U700</key>
<array>
<string>copy:</string>
<string>moveUp:</string>
<string>moveToEndOfLine:</string>
<string>insertLineBreak:</string>
<string>insertNewLine:</string>
<string>setMark:</string>
<string>paste:</string>
<string>selectToMark:</string>
</array>
<key>^~\U701</key>
<array>
<string>copy:</string>
<string>moveDown:</string>
<string>moveToBeginningOfLine:</string>
<string>insertLineBreak:</string>
<string>insertNewLine:</string>
<string>moveUp:</string>
<string>setMark:</string>
<string>paste:</string>
<string>selectToMark:</string>
</array>
2. Delete Line.
Deletes the current line your cursor is on. press Ctrl + D.
<key>^d</key>
<array>
<string>cut:</string>
<string>selectLine:</string>
<string>cut:</string>
</array>