Twitter login using twitter framework in 'static library'


I have created static library project, in that i am trying to Twitter sharing. But when i tried to on Twitter the application is crashes at following line

NSString *_oAuthNonce = [NSString ab_GUID];

by error:

+[NSString ab_GUID]: unrecognized selector sent to class 0x1a09fd8

ab_GUID this method is present in OAuthCore class

  • (NSString *)ab_GUID
    CFUUIDRef u = CFUUIDCreate(kCFAllocatorDefault);
    CFStringRef s = CFUUIDCreateString(kCFAllocatorDefault, u);
    return [(NSString *)s autorelease];
    (My all classes are present in static Library)


The +[NSString ab_GUID] method is from a category on NSString. When you’re working with static libs you need to add the “-all_load” flag to the linker (and also potentially the “-ObjC” flag, depending on your setup).

You can read about why that’s necessary here:

A relevant SO discussion is here: