# Spatialite for iOS Install compiler dependencies ``` brew install automake autoconf libtool libxml2 pkg-config brew link libxml2 ``` Build libspatialite ``` git clone https://github.com/gstf/libspatialite-ios.git cd libspatialite-ios make ``` The result is a folder, lib, containing several `.a` files, as well as an `include` folder containing many `.h` files. Create a new XCode project Copy the libspatialite binaries and "include" folder into a folder named "libspatialite" in the XCode project folder. ![filesystem](https://gist.github.com/aaronpk/0252426d5161bc9650d8/raw/f437a0f29152f98b57d9e64907ac51af2de36fd4/filesystem.png) In the XCode project's "Build Settings", you'll need to set the library and header search paths: Library Search Paths: $(PROJECT_DIR)/AppName/libspatialite Header Search Paths: $(PROJECT_DIR)/AppName/libspatialite/include ![search paths](https://gist.github.com/aaronpk/0252426d5161bc9650d8/raw/9e2d992cf4e5a9c15289cfe06245cedb8592fab5/search-paths.png) Drag the `.a` files into your project. From the "Build Phases" window, add the following to the section "Link Binary With Libraries": * libz.dylib * libxml2.2.dylib * libc++.dylib * libcharset.1.0.0.dylib * libiconv.dylib ![XCode Project](https://gist.github.com/aaronpk/0252426d5161bc9650d8/raw/64dee2f14eef7e45cde5b28f4e62c1b42168550d/xcode-project.png) Now you should be able to use spatialite! To test if everything worked, just make your AppDelegate output the spatialite version. Add the following to AppDelegate.m ``` #include #include #include ``` In your `application:didFinishLaunchingWithOptions:` method, add: ``` spatialite_init (0); printf("Spatialite version: %s\n", spatialite_version()); ``` Compile and run and you should see the version output in the console!