Re: Problem with extension moved to a static library - "unrecognized selector sent to instance"
Re: Problem with extension moved to a static library - "unrecognized selector sent to instance"
- Subject: Re: Problem with extension moved to a static library - "unrecognized selector sent to instance"
- From: Jean-Daniel Dupas <email@hidden>
- Date: Tue, 7 Oct 2008 20:41:53 +0200
Le 7 oct. 08 à 20:28, Stuart Williams a écrit :
XCode experts-
I have an extension to NSFileManager that was working fine. The .h
and .m for the extension was located in a project that built my
application. Since the extension was pretty generic, I decided to
move the extension (along with a number of other classes) to another
XCode project, the target of which was a static library.
The new static library project builds fine with no errors, as does
the original application project that has a dependency on the new
static library project.
The problem is that when I run the application, I get a
"unrecognized selector sent to instance" error when I attempt to use
the extension from the application. My guess is that that link
phase is failing to pick up the application's dependency on the the
object code in the static library, but I'm not sure if that's the
problem.
Can anyone shed any light on this problem? Is there any reason I
can't define an extension in a static library and then use that
extension in another project?
Thanks,
Stuart
You should add a linker flags:
-W,ObjC
man ld:
-ObjC Loads all members of static archive libraries that
implement an Objective-C class or category.
The linker strip the code that is not referenced in static libraries,
and objc extensions are never directly referenced (due to the dynamic
nature of ObjC), and so, it does not include it in your final
executable.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden