Steps to reproduce:
Create a new Xcode Workspace (WorkspaceTest).
Create a single-view project called "One".
In the workspace (not the project), create a Group called "Shared". In that folder create a category called UIColor+Hex:
.h:
@interface UIColor (Hex)
+ (UIColor *)colorWithHexString:(NSString*)hexString;
@end
.m:
@implementation UIColor (Hex)
+ (UIColor *)colorWithHexString:(NSString *)hexString {
//implementation here
}
@end
Go to the "One" Target Build Settings and add this for Header Search Paths:
/Users/me/iOS/test/WorkspaceTest/Shared
Go to the default ViewController.h and add this:
#import "UIColor+Hex.h"
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor colorWithHexString:@"ff0000"];
}
The project compiles fine, which means it found UIColor+Hex.h.
However when it runs I get this:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[UIColor colorWithHexString:]: unrecognized selector sent to class 0x107db8c60
This method is present in the UIColor+Hex.m file. What else do I need to do?