-
Notifications
You must be signed in to change notification settings - Fork 126
Adding libPusher to your project
There are a number of ways in which you can add libPusher to your project. This page documents how to get up and running with libPusher as quickly as possible.
First of all, you need to decide whether or not you want to use the latest version from source or download a pre-compiled static library. Downloading a pre-compiled static library is the quickest way to get up and running, however depending on how you manage your project (e.g. if you use CocoaPods or git submodules) you may want to use one of the alternative methods below.
On the project Downloads page, you'll find a couple of different packages to download. Most people will want to grab the latest stable release, however there is also an automated nightly build if you want to run a bleeding-edge version.
Contained within each download package are a number of static libraries and a collection of header files. For more information, read the README file contained within the download.
Most people will want to use the combined fat static library. Simply copy libPusher-combined.a
and the contents of the headers
directory into your Xcode project and then:
-
Under the Build Phases tab for your target, expand "Link Binary With Libraries" and if libPusher-combined.a isn't there already, click the + symbol and add it.
-
Locate the "Other Linker Flags" build setting for your target and add
-all_load
.
You should now be able to build your project.
Important note: if you are using the pre-compiled static library and you are using the libraries JSONKit or CocoaAsyncSocket in your project already, you will need to remove the implementation files for these libraries from your project as they are already compiled into the libPusher binaries. Leaving these files in your project will result in duplicate symbol errors from the linker. You should however leave the header files in your project in order to use them in your own source files.
CocoaPods is an Objective-C package manager; if you are familiar with the Rubygems eco-system, it is somewhere between Rubygems and Bundler - it allows you to manage all of your project dependencies using a simple manifest file. For more information on getting up and running with CocoaPods, you should read the documentation.
Assuming you do not have a Podfile
in your project root already, go ahead and create one:
platform :ios
dependency 'libPusher', '1.0'
You can now use pod
to install libPusher:
$ pod install
If this is the first time you've used CocoaPods for your project, an Xcode workspace containing your project and the Pods project will have been created. If you open this workspace file in Xcode, you should now be able to build your project - the Pods dependencies (including libPusher) will be compiled into a static library and linked to your own app/target.