zzzzz
zzzzz

Reputation: 1239

Correct way to use a private library in objective c?

I downloaded a collection of private libraries from this link. When I click download I get all frameworks. So these are only header files not the .framework files that are available in Xcode. So I linked them by the usual method of going to build phases, in it I go to link binary with libraries click on + and choose the header files from a framework (preferences framework in my case). After these files are added to my project I try to make an object from one of the libraries and try to call their instance methods. When I try to execute this program I get this error. I get this whether I run it on the device or simulator.

Undefined symbols for architecture i386:
"_OBJC_CLASS_$_DevicePINController", referenced from: objc-class-ref in UAViewController.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)

DevicePinController is a part of a private framework preferences.h.I am trying to make an object of it UA

EDIT: I tried using other framework headers such as bluetooth and I get this error in all.

EDIT: I tried adding the entire framework to the project instead of adding individual header files.Now the error is

d: framework not found BluetoothManager clang: error: linker command failed with exit code 1 (use -v to see invocation)

Upvotes: 2

Views: 1659

Answers (1)

paulmelnikow
paulmelnikow

Reputation: 17208

You'll need to actually build the framework. You can't just link against a header file; that doesn't make sense.

Try adding all the .m files in the Preferences folder as Compile Sources, and remove the header file from Link Binary with Libraries.

Added: I realize now this answer is incorrect. The files OP is trying to use are not a library, but header files from Apple's private frameworks. Here's a related answer: https://stackoverflow.com/a/13388225/893113

Upvotes: 1

Related Questions