How to link library with "-force_load" in Xcode?

My other libraries do not allow me to set the -ObjC or all_load flags. So I need to use -force_load to link my library.

I have "GoogleOpenSource.framework" and "GooglePlus.framework" in my project, since I can correctly match them to work.

I have installed paths like this:

-force_load $(PROJECT_DIR)/Project_name/GooglePlus.framework/Versions/A/Headers/GooglePlus.h -force_load $(PROJECT_DIR)/Project_name/GoogleOpenSource.framework/Versions/A/Headers/GoogleOpenSource.h 

under other linker flags, but it does not work.

What am I doing wrong here?

+5
source share
2 answers

I ran into the same problem, but finally I fixed it with the following steps: -

measures

  1. Go to the โ€œother linker flagsโ€ in your projectโ€™s build settings, and then
  2. Add -force_load $(PROJECT_DIR)/yourframewokname.framework/yourframeworkname

Note ** A framework that requires the addition of the -ObjC flag inside the flag of another linker, in this case it conflicts with other libraries, so in this case you need to force the library that requires -ObjC to be loaded.

Use the above steps, it works.

+1
source

-force_load flag is designed to load static libraries, so you put the library archive NOT the header file as a parameter.

Use the following instead:

 -force_load GooglePlus.framework/Versions/Current/GooglePlus -force_load GoogleOpenSource.framework/Versions/Current/GoogleOpenSource 
+1
source

All Articles