简体   繁体   English

如何在iOS中正确链接第三方库

[英]How to link third party libraries properly in iOS

I'm new in iOS development, and met this library linking problem in last few days. 我是iOS开发的新手,在最近几天遇到了这个库连接问题。

I was trying to use GMGridView in a project, but cannot make it working. 我试图在项目中使用GMGridView ,但无法使其工作。

This project is shipped as static library, so I just drag the xcodeproj file in my project. 这个项目是作为静态库提供的,所以我只需在项目中拖动xcodeproj文件。 Then I added libGMGridView.a in Link Binary With Libraries, GMGridView in Target Dependencies . 然后我在Link Binary With Libraries中添加了libGMGridView.a Target Dependencies中添加了GMGridView。 I also added the path in Header Search Paths . 我还在标题搜索路径中添加了路径

However, Xcode still report .h file not found error when I tried to import GMGridView.h. 但是,当我尝试导入GMGridView.h时,Xcode仍然报告.h文件未找到错误。

Could anyone give me a hand on this? 有人能帮我一把吗? Thanks in advance! 提前致谢!

Had the same issue!!! 有同样的问题!!! Made it work!!!! 让它工作!!!! soooooooo: soooooooo:

  1. copy GMGridView folder from https://github.com/gmoledina/GMGridView to your project dir https://github.com/gmoledina/GMGridView复制GMGridView文件夹到您的项目目录
  2. in xcode right click on any file group and choose add files 在xcode中右键单击任何文件组,然后选择添加文件
  3. find GMGridView folder in your folder dir and choose GMGridView.xcodeproj - (dont copy, create groups not folders, add targets) 在您的文件夹目录中找到GMGridView文件夹并选择GMGridView.xcodeproj - (不要复制,创建组不是文件夹,添加目标)
  4. go to your project targets - search - HEADER_SEARCH_PATHS add- GMGridView/** 转到您的项目目标 - 搜索 - HEADER_SEARCH_PATHS add- GMGridView / **
  5. select Building phases in settings - choose target dependencies and add GMGridView 选择在设置中构建阶段 - 选择目标依赖项并添加GMGridView
  6. select Building phases in settings - link binary libraries and add libGMGridView.a 选择设置中的构建阶段 - 链接二进制库并添加libGMGridView.a

import should be: 进口应该是:

#import "GMGridView.h"
#import <QuartzCore/QuartzCore.h>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM