Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

I was trying to use GMGridView in a project, but cannot make it working.

This project is shipped as static library, so I just drag the xcodeproj file in my project. Then I added libGMGridView.a in Link Binary With Libraries, GMGridView in Target Dependencies. 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.

Could anyone give me a hand on this? Thanks in advance!

like image 409
Selkie Avatar asked Jun 12 '12 03:06

Selkie


1 Answers

Had the same issue!!! Made it work!!!! soooooooo:

  1. copy GMGridView folder from https://github.com/gmoledina/GMGridView to your project dir
  2. in xcode right click on any file group and choose add files
  3. find GMGridView folder in your folder dir and choose GMGridView.xcodeproj - (dont copy, create groups not folders, add targets)
  4. go to your project targets - search - HEADER_SEARCH_PATHS add- GMGridView/**
  5. select Building phases in settings - choose target dependencies and add GMGridView
  6. select Building phases in settings - link binary libraries and add libGMGridView.a

import should be:

#import "GMGridView.h"
#import <QuartzCore/QuartzCore.h>
like image 112
Tim Kozak Avatar answered Oct 07 '22 06:10

Tim Kozak