Return to Snippet

Revision: 42766
at March 10, 2011 06:02 by BenClayton


Initial Code
//CategoryBugHack.h
#define FIX_CATEGORY_BUG(name) @interface FIX_CATEGORY_BUG##name @end @implementation FIX_CATEGORY_BUG##name @end
Then the category .h/.m ...

//NSStringCategory.h
@interface NSString (MyAdditions)
// etc, etc
@end

//NSStringCategory.m
#import "CategoryBugHack.h"
FIX_CATEGORY_BUG(NSString_MyAdditions)
@implementation NSString (MyAdditions)
// etc, etc
@end

Initial URL


Initial Description
There seems to be an bugrelated to static libraries with an implementation file that contains ONLY implementations of category methods. The FIX_CATEGORY_BUG macro basically just expands to define an interface and implementation of that interface with no methods, just to force something into the .m file that isn't a category.

Initial Title
iPhone: Make categories defined inside libraries actually work

Initial Tags


Initial Language
Objective C