Bliq Park SDK 2.0 for iOS

Getting Started

This guide will show you how to use the BliqPark framework which helps you to use the Bliq parking services. It takes just a few minutes to drop a production-ready parking layer into your application.

Contribute on GitHub

Requirements

  • iOS 12+
  • Swift 4

CocoaPods

CocoaPods 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, '12.0'
use_frameworks!

target '' do
    pod 'BliqPark'
end

Dependencies

The following cocoa pods are required to run BliqPark

  • Alamofire ~> 4.0
  • SwiftyJSON >= 0

First Steps

To use the BliqPark SDK, import the package and initialize the BliqPark class

import BliqPark

let bliq = BliqPark(apiKey: <yourAPIKey>)

Authorization

BliqPark is a location-based service. In order to use BliqPark, 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

Note: You also need to allow location updates in the background mode. Otherwise, there will be an exception during the usage of the framework.

Request parking areas

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

An example of a request to get parking areas is shown below. This returns a set of parking areas near a given point. You can also request information for Map Tiles, Polygons or a set of given parking areas. Learn more about the different ways to request information here.

let bliq = BliqPark(apiKey: <yourAPIKey>)
let point = CLLocationCoordinate2D(latitude: 52.26421778466458, longitude: 10.520997047424316)
let request = NextToPointRequest(value: .init(limit: 30, point: CenterPoint(latitude: point.latitude, longitude: point.longitude)))
bliq.getOnStreetParkingOptions(request: request, mapLayers: [.prediction,.rules]) {
  (parkingAreas,Error) in
  for entry in parkingAreas ?? [] {
    print(entry.streetName)
  }
}

Known issues

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/com.apple.xbs/Sources/CoreLocationFramework_Sim/CoreLocation-2245.4.104/Framework/CoreLocation/CLLocationManager.m:652
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: !stayUp || CLClientIsBackgroundable(internal->fClient)'
Updated on December 7, 2019

Was this article helpful?

Related Articles

Bitnami