3

I am pretty new in iOS development, and I found a library I'd like to use in my app:

https://github.com/ustwo/US2FormValidator

I followed the steps the authors described in their documentation to import their project into mine, but Im not able to #import the imported project's .h files from my code. I also see that the library item in target's build phases remains in red. Maybe I am not importing the project properly, I copied the whole project folder into mine's folder, and then in the Xcode's project navigator of my project: right click > Add files to project > select the .xcodeproj file of the project I want to import, and that have been copied into my project folder. Is that the way to do this?

AppsDev
  • 12,319
  • 23
  • 93
  • 186
  • I think this can help you: http://stackoverflow.com/questions/3352664/how-to-add-existing-frameworks-in-xcode-4 Good Luck! – lmt Nov 18 '12 at 15:43
  • Thanks, I did what describes in that thread, excepting for dragging and dropping the item to the "Frameworks" group in the project navigator... and the item is in red even if I build the app – AppsDev Nov 18 '12 at 18:04

2 Answers2

1

I finally made it work by setting the Header Search Paths, having previously added the target dependency and linked the binary with the library in Build Phases... thanks you all for your answers.

AppsDev
  • 12,319
  • 23
  • 93
  • 186
0

You appear to have imported the project properly. (You didn't have to necessarily copy the project folder inside yours, but personal preference...) Normally Xcode does the right thing connecting up headers and source files, but I've had to occasionally manually add files to the target's Build Phases window. (Especially adding headers to the Copy Headers build phase if your subproject builds a static library.) Speaking of which, make sure that you add the appropriate target to the Target Dependencies list so that Xcode knows to compile its requisite files.

rsswtmr
  • 1,776
  • 5
  • 16
  • 26
  • I've added the target dependency and the linked the binary with the library as it is described in the url I referenced, but I am still unable to make .h files imports in my code... I guess you were also talking about setting the Header Search Paths or the Framework Search Paths... how do I configure that? – AppsDev Nov 18 '12 at 18:00
  • You really shouldn't have to--the sub-project file contains that information. The only time you need to set header search paths is when you're referring to headers that aren't in the projects' search paths (like for dynamic libraries, etc.). If you do need to search additional paths, click on the main project file in the file navigator, click on the project icon, and search for User Header Search Paths. You add directory paths there. You also then have to set the "Always Search User Paths" build setting. – rsswtmr Nov 18 '12 at 18:36