Sreehari
Sreehari

Reputation: 201

NSConcreteData vs NSData

I have added an extension to NSData (base64 extension), which I kept over a separate infrastructure class lib project. But when i use this method from my main project i am getting an error like this: "-[NSConcreteData encodeBase64]: unrecognized selector sent to instance 0x121e60'".

But if i keep the same class in my main project itself, this will execute with out any issue.

I call this method in the following way: [dev setToken:[token encodeBase64]];

Please suggest why this is not working if i put the extension in another project. (I am already using some other extensions, eg. for NSDate, like this with out any issue.)

Upvotes: 2

Views: 3113

Answers (2)

Brad Larson
Brad Larson

Reputation: 170319

Is this on iPhone OS 3.0? The 3.0 SDK broke the use of -ObjC, but you usually are able to link in categories for a static library by adding the -all_load option to Other Linker Flags within your target application.

Upvotes: 3

Louis Gerbarg
Louis Gerbarg

Reputation: 43452

The issue is that the metadata necessary to configure a category is usually stripped by the linker because it appears to be dead. If you add the "-ObjC" LDFLAG to your project it will tell the linker to link all the potential ObjC info even if it appears to be dead.

Upvotes: 0

Related Questions