No description, website, or topics provided.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

AIPARK: Artificial Intelligence Based Parking

Build Status CocoaPods Compatible Platform Twitter License

Starting Guide

This guide will show you how to use the AIPARK framework which helps you to use the AIPARK services.


  • iOS 10+
  • swift 4


Cocoa Pods

CocoaPod is a dependency manager for Cocoa projects. You can install it with the following command:

gem install cocoapods

To integrate Alamofire into your Xcode project using CocoaPods, specify it in your Podfile:

platform :ios, '10.0'

target '<Your Target Name>' do
    pod 'AIPARKSDK'


The following cocoa pods are required to run aipark

  • Alamofire
  • SwiftyJSON

First Steps

To use the AIPARK SDK, import the package and initialize the AIPARK class.


let aiparkcontroller = AIPARK(apikey: <yourAPIKey>)



To use AIPARK, we need the current GPS position of the device. Therefore, add the following keys to the info.plist file.

Key Purpose
NSLocationWhenInUseUsageDescription Reason why GPS is used while app is in use
NSLocationAlwaysAndWhenInUseUsageDescription Reason why GPS is used in background
NSMotionUsageDescription Reason why motion sensor is used (required to detect leaving a parking spot).


You also need to allow location updates in Background Mode. Otherwise there will be an exception during the usage of the framework.

Request ParkingAreas

To request parking areas, you need to specify a request object. This object contains the tile that you wish to get parking areas from.


Tiles are predefined map areas. To visualize these tiles, you can visit this website Tiles. You can request tiles on the zoom levels 15 to 16. To convert a GPS coordinate with Latitude/Longitude into a tile, you can use a predefined method:

func getTileForCoordinates(latitude: Double, longitude: Double, zoom: Int) -> (x: Int, y: Int) 

An example of a request to get parking areas is shown below. This returns a set of parking areas from the specified tiles.

let aiparkcontroller = AIPARK(apikey: <yourAPIKey>)
let test = ParkingAreaRequest(tiles: [Tile(x: 35209, y: 21496)])
aiparkcontroller.getParkingAreas(request: test) { (parkingareas) in
  for entry in parkingareas {


When you request parking areas, they are cached automatically to minimize network traffic. If you request the same tile twice you will see an performance increase as the API response is already cached. Therefore just perform a second request with the getParkingAreas method. To keep the results up-to-date, the areas will be deleted every 15 min from the cache. If you request them again, they will be fetched from the webservice after that time limit.


SIGABRT after start

If you see error messages like the following right after the app started the permission for the background mode is missing. To solve this go to your project in XCode and click on your project name in the left bar. Then switch to the capabilities tab and activate the 'Background Modes', specially the 'Location updates'.

*** Assertion failure in -[CLLocationManager setAllowsBackgroundLocationUpdates:], /BuildRoot/Library/Caches/
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: !stayUp || CLClientIsBackgroundable(internal->fClient)'