1

I'm building a static library in iOS. after importing that library in my project, I added -ObjC in Other linker flags. But when I call the class methods(currently 3 available), 2 of them are being called and executed properly, but the last one is getting this error: "+[RankConferenceLib joinConferenceWithName:]: unrecognized selector sent to class 0x5044dc".

This is my Header file of library

@interface RankConferenceLib : NSObject


+(void)initEnvironment;
+(void)orientationChange;
+(void)joinConferenceWithName:(NSString *)name;
@end

in .m file of library

+ (void)joinConferenceWithName:(NSString *)name
{
       //....codes
}

and in my project I'm calling them

- (IBAction)join:(UIButton *)sender {
    [RankConferenceLib joinConferenceWithName:@"User"];
}

Please tell me what I'm missing here. This is my first static library. I've searched but could not find any help which is similar as my situation here. Please mention what else you need to know.

Thank you.

Kirit Modi
  • 23,155
  • 15
  • 89
  • 112
Bobby
  • 141
  • 11

2 Answers2

0

Try Running using the -all_load linker flag

Apple Documentation

Stack Overflow Answer

Community
  • 1
  • 1
0

I have checked this and for me it's working fine without any linker flags added.

The only one error possibility is something happened inside the + (void)joinConferenceWithName:(NSString *)name

Write a log inside the joinConferenceWithName to printout the parameter name and make sure this is calling and the problem is occurring inside that method.

+ (void)joinConferenceWithName:(NSString *)name
{
    NSLog(@"the name is: %@", name);
}

Finally, make sure that you added the latest modified static library into your project.

You can download the working sample from here

Shamsudheen TK
  • 30,739
  • 9
  • 69
  • 102
  • Finally i exited my Xcode, cleaned both project, and freshly added the library, then my method was properly found. Thanks @Ramshad – Bobby Jan 21 '15 at 07:08