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;
}