Xcode cannot import tapku or kal library

别说谁变了你拦得住时间么 提交于 2019-12-19 04:15:05

问题


I am having trouble importing the tapku library (to use the calendar api it provides). I've also tried Kal with the same problem. Here's what I do to import it (please tell me if I'm missing something) (using Xcode 4.5).

  1. Go file > Add files to project > TapkuLibrary.xcodeproj > copy items into destination's group folder unchecked, Create folder references selected, add to target "my project" checked.

  2. Go file > Add files to project > TapkuLibrary.bundle > same settings as above.

  3. Under build settings, under "header search paths", add the file to the tapku library "src" folder (and leave the box on the left unchecked). I have another item from a different api i used in my project in header search paths, too. Does this matter?

  4. Go to build phases, and add Tapku Library under target dependencies and libTapkuLibrary.a under Link binary with libraries.

So after doing this, when I go to a file in my project and try

#import <TapkuLibrary/TapkuLibrary.h>

It says "TapkuLibrary.h file not found"

By the way, the Tapku folder itself is on my desktop, not in the application's root folder.

Please tell me if I am missing something or doing something wrong. Thank you so much! Luke


回答1:


Using the same numbers for the steps you listed:

1) Correct - do not copy the project.

2) I don't normally have to do this for included libraries but perhaps you need this for this framework (I assume you've been told to do this)

3) The header search path has to be the same string you would use from the shell to get from the directory your project is in to the top level folder (directory) of the think you want to find. In your case, it is a folder TapkuLibrary. Your path can be relative to the directory the project is in:

./../../../Foo/Goop/TapkuLibrary

or it can be an absolute path:

/Users/jfk/Desktop/TapuLibrary

So figure out the string you think is correct, then open Terminal, cd to the directory where your project file is, then type "ls " and see if it lists the contents of the directory. If not, then figure out what you did wrong.

Its probably a good idea to set the "recursive" flag - if you double click on Header Search Paths, you can select the box on the left (or you can type in a "/**" postfix to the path).

4) Do not use:

#import <TapkuLibrary/TapkuLibrary.h>

That is telling Xcode that this is a System folder (in /usr/include), etc. In the manner you are using this it should be a user folder:

#import "TapkuLibrary/TapkuLibrary.h"



回答2:


I've really struggled to add Kal and Tapku. This is almost a complete guide.

I would add (for any one coming down this road later) - You also need to go to "Build Settings" go to "Other Linker Flags" and enter -all_load .

I couldn't get it to work without that small addition.



来源:https://stackoverflow.com/questions/12133270/xcode-cannot-import-tapku-or-kal-library

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!