1
votes

I created a static Library but I am unable to import it. Here are the steps that i followed to add it to my project.

1) From finder, I dragged my library .xcodeproj into my main project.

2) I selected the main project, went to target and then build phases.

3) I added the library under Link Binary With Libraries and Target Dependencies.

4) Under Build Settings -- Header Search Paths, I added $(BUILT_PRODUCTS_DIR).

5) I also added -ObjC to Other Linker Flags.

However when I try importing the library, it's not being recognised. Can anyone help with this?

1
If you have copied the .xcodeproj into your main project then you can simply mention ${SRCROOT}/<Path to the lib headers>/ under Header Search Path. Ensure there is no space anywhere in the path. - Amar
@Amar I tried that too but the same issue still arises. - Amrita
@iPatel This solution didn't work in my case. - Amrita
@Amrita Can you post the error that you are getting? - Amar

1 Answers

7
votes

You can include library by two ways either u can drag and drop library.xcodeproj into your project or you can include .lib file into your project. It might be possible that your lib file was not build properly. You could build ur lib file by opening ur library.xcodeproj in xcode select build target as iOS Device and build the project. If build is successful u could find the newly created .lib file to the following path LIbrary/Developer/Xcode/DerivedData now remove the previous lib file and include the new lib.