This is a quick guide on setting up ObjectiveGit for an iOS project. The example code clones a repository if it doesn't already exist, and displays the latest commit message. Don't expect much; it's only meant to get you started.
- Create a new project on Xcode (make sure to check "initialize a git repository"). Do not use spaces in the project name; the
bootstrap
script for ObjectiveGit will not work with paths with spaces - At the command line,
cd
into your project root, and rungit submodule add git@github.com:libgit2/objective-git.git
. - Make sure you have installed Brew, a package manage for OSX, which the
bootstrap
script uses to pull dependencies cd
intoobjective-git
, then run./script/bootstrap
. The first build may take a while (~10 minutes)- Open Finder (
open .
). DragObjectiveGitFramework.xcodeproj
into Xcode onto your project. Xcode may ask to "Share working copy"; just click yes; it doesn't seem to matter - In the "Build Phases" tab, add
ObjectiveGit-iOS-arm64
under "Target Dependencies" - Under "Link Binary With Binaries", add "
libObjectiveGit-iOS.a
from 'ObjectiveGit-iOS-arm64' target",libz.dylib
, andlibiconv.dylib
- In the "Build Settings" tab, set "Always Search User Paths" to
YES
- Add
$(BUILT_PRODUCTS_DIR)/usr/local/include
, and$(PROJECT_DIR)/objective-git/External/libgit2/include
to "User Header Search Paths" - Add
-all_load
to "Other Linker Flags" - Don't forget to
#import <ObjectiveGit/ObjectiveGit.h>
as you would with any other framework
git clone ...
git submodule update --init --recursive
cd objective-git
./script/bootstrap
- In Xcode, choose "Open Other" and import the
.xcodeproj
file - Everything else should already be set up
- You may have to add
GTRepositoryCloneOptionsTransportFlags: @YES
to the options of[GTRepository cloneFromURL:...]
to disable checking SSL certificates. This appears to be an error on the iOS simulator