开发者

How do I properly add the Kal framework to my iPhone project?

I'm new to iPhone development and I'm having trouble using the 3rd part Kal framework in my project. I c开发者_如何学Can't find any documentation on how to add the Kal framework to my code, so I assumed it was just a matter of adding the source files to my project's "Groups and Files" and set the Header file search path to include the new code.

  1. Is that all I need to do to properly add the Kal framework to my iPhone project?
  2. I'm getting this error (shown below), what is it indicating?

    Undefined symbols: ".objc_class_name_KalViewController", referenced from: literal-pointer@__OBJC@__cls_refs@KalViewController in RootViewController.o ld: symbol(s) not found

    I get this error when I add the statement...

    kalViewController = [[[KalViewController alloc] init] autorelease];

    to my RootViewController.m viewDidLoad method and #import "Kal.h"

Thanks so much for your help!

UPDATE: I found this response (shown below) in a similar SO question...

There is also another thing to do: check in the file list when you select the "Classes" group. The checkbox next to the .m files must be enabled (which tells XCode to compile and link the file) especially if u add them with "Add existing files..." command.

I checked and my KalViewController.m files doesn't have a checkbox checked (which I think means it's not added to my target), but how do I check the checkboxes next to the files I need? I'm so confused...

UPDATE: Thanks to Alex's comments below, I created a new project from scratch and dragged the Kal code into Xcode, then after adding the problematic lines of code mentioned above, everything built fine.


From GITHUB:

In XCode 4 click on your project in the project navigator. Say add files to project and find the Kal.xcodeproj. file and add it. When you see the Kal Project under your project you are almost there. Now again select your project in the project navigator and go to build settings. there search for "Linker" and fill in Other Linker Flags: "-Objc and -all_load", also insert the path to the Kal directory in the Library Search Paths and the relative path from your project to the kal project under: "Header Search Paths". Thats it for Build settings.

Now go to Build Phases: Add the Kal static library to the target dependencies, also add the libKal.a to Link Binary with Libraries and at the end add the Kal.bundle to "Copy Bundle Resources".


You might try moving the #import "Kal.h" to RootViewController.h instead on in RootViewController.m.

Edit: Normally what you do to include a framework such as Kal in an Xcode project is simply drag all the source code into your project. You shouldn't have to change the header search path if you copied the source entirely. This might be causing the problem.


I think kal is static, infact it is -

follow the instructions on https://github.com/klazuka/Kal and will tell you best way about adding the kal library to your project.


With XCode 4 I believe the approach would be to create a new 'workspace' and then add both your project and the Kal project into it.

see: http://developer.apple.com/library/mac/#documentation/ToolsLanguages/Conceptual/Xcode4UserGuide/NewProject/NewProject.html

I did this for a migrated project and I then needed to add the libKal.a to the Build Phases for my project. It shows the file as 'missing' (i.e. in red with a blank dash-border icon) but it seems to work...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜