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
bootstrapscript for ObjectiveGit will not work with paths with spaces - At the command line,
cdinto 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
bootstrapscript uses to pull dependencies cdintoobjective-git, then run./script/bootstrap. The first build may take a while (~10 minutes)- Open Finder (
open .). DragObjectiveGitFramework.xcodeprojinto 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-arm64under "Target Dependencies" - Under "Link Binary With Binaries", add "
libObjectiveGit-iOS.afrom '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/includeto "User Header Search Paths" - Add
-all_loadto "Other Linker Flags" - Don't forget to
#import <ObjectiveGit/ObjectiveGit.h>as you would with any other framework
git clone ...git submodule update --init --recursivecd objective-git./script/bootstrap- In Xcode, choose "Open Other" and import the
.xcodeprojfile - Everything else should already be set up
- You may have to add
GTRepositoryCloneOptionsTransportFlags: @YESto the options of[GTRepository cloneFromURL:...]to disable checking SSL certificates. This appears to be an error on the iOS simulator