The full documentation and instructions on how to integrate PACE Cloud SDK can be found here.
The complete source code of the SDK can be found on GitHub.
In 3.0.0 we’ve introduced a universal setup method: PACECloudSDK.shared.setup(with: PACECloudSDK.Configuration) and removed the setup for AppKit and POIKitManager.
The PACECloudSDK.Configuration almost has the same signature as the previous AppKit.AppKitConfiguration, only the theme parameter has been removed, which is now defaulted to .automatic. In case you want to set a specific theme, you can set it via AppKit’s theme property: AppKit.shared.theme.
In 4.0.0 we’ve simplified the setup even further.
The PACECloudSDK.Configuration doesn’t take an initialAccessToken anymore and will (as before) request the token when needed via the tokenInvalid callback.
Furthermore, the handling of the redirect scheme has been updated. The SDK automatically retrieves the URL scheme from your app’s Info.plist, therefore no clientId needs to be set within the PACECloudSDK.shared.setup() anymore.
The PoiKitManager has been removed as PACECloudSDK’s instance property. Instead it can be initialized directly via POIKit.POIKitManager(environment:).
In 5.0.0 we’ve removed the option to pass a force parameter to the IDKit.refreshSession(...) call.
We’ve added more information in the tokenInvalid callback, thus the client can better react to the callback, i.e. a reason and the oldToken (if one has been passed before), will be included in the callback.
In version 7.x.x we’ve made some big AppKit and IDKit changes.
AppKit’s invalidToken callback has been replaced with a new getAccessToken callback.
IDKit this callback will be invoked and will have the same functionality as invalidToken before.IDKit the behavior now heavily changes:
getAccessToken will not be called anymore.IDKit first starts an attempt to refresh the session automatically.func didFailSessionRenewal(with error: IDKit.IDKitError?, _ completion: @escaping (String?) -> Void) function that you may implement to specify your own behaviour for retrieving a new access token. This can be achieved by specifying an IDKitDelegate conformance and setting the IDKit.delegate property.IDKit setup has been combined with the general SDK setup.
IDKit.setup(...) is no longer accessible.OIDConfigurationClientID and OIDConfigurationRedirectURI with non-empty values to your Info.plist IDKit will be initiated with the default PACE OID configuration.PACECloudSDK.Configuration if desired.resetAccessToken() has been removed from the PACECloudSDK.shared proprety. This functionality is simply no longer needed.IDKit.OIDConfiguration’s property redirectUrl has been renamed to redirectUri.IDKit.swapPresentingViewController(...) has been removed. The presenting view controller for the sign in mask now needs to be set directy via IDKit.presentingViewController.Authorization header for any requests performed by the SDK. It will be included automatically.logout callback has been added to AppKitDelegateauthenticationMode of the SDK to .native.
NOTE: If you are not using native authentication make sure to explicitely set the mode to
.webin the SDK configuration if it isn’t already.
authorize(...) call has been changed from (String?, IDKitError?) to (Result<String?, IDKitError>)refreshToken(...) call has been changed from (String?, IDKitError?) to (Result<String?, IDKitError>)discoverConfiguration(...) call has been changed from (String?, String?, IDKitError?) to (Result<OIDConfiguration.Response, IDKitError>)userInfo(...) call has been changed from (UserInfo?, IDKitError?) to (Result<UserInfo, IDKitError>)didCreateApplePayPaymentRequest callback has been changed from [String: Any]? to API.Communication.ApplePayRequestResponse?getAccessToken callback has been changed from AppKit.GetAccessTokenResponse to API.Communication.GetAccessTokenResponseisPoiInRange(...) call is now part of POIKit, available under POIKit.isPoiInRange(...)requestCofuGasStations(...) call is now part of POIKit, available under POIKit.requestCofuGasStations(...)CofuGasStation is now part of POIKit, available under POIKit.CofuGasStationshared property is no longer publicly accessible. All methods and properties of type AppKit.shared.fooBar() are now accessible via AppKit.fooBar()fetchListOfApps(...) call has been changed from ([AppKit.AppData]?, AppKit.AppError?) to (Result<[AppKit.AppData], AppKit.AppError>)poisOfType has been removed from POIKitManager’s methods fetchPOIs(boundingBox:) and loadPOIs(boundingBox:)loadPOIs(locations:) has been renamed to fetchPOIs(locations:)TokenValidator is now part of IDKit instead of AppKitPOIKit.requestCoFuGasStation(center:, radius:) does not filter the stations by their online status any more. The response may now also include offline stationsNSPhotoLibraryUsageDescription to be set in target properties)PACECloudSDKLoggingDelegate does not exist any more.geoAppsScope in the SDK configuration the POIKit.CofuGasStation property polygon will from now on be nil.AppViewController instances the property isModalInPresentation is now true by default. Setting it to false can be done via the initializer or afterwards by directly accessing the property.API.Communication.ApplePayRequestRequest, API.Communication.ApplePayRequestResponse and the two callbacks in AppKitDelegate paymentRequestMerchantIdentifier(completion: @escaping (String) -> Void) + didCreateApplePayPaymentRequest(_ request: PKPaymentRequest, completion: @escaping (API.Communication.ApplePayRequestResponse?) -> Void) have been removed.cofuStatus property of CofuGasStation is now optional. This way it correctly reflects the connected fueling status in case the original value is missing in the API responseIDKit.TokenValidator are no longer static. Instead create an instance and pass your access token in the initializer.IDKit.resetSession now either provides a success or a IDKitError within it’s completion block.GeoJSON API has been completely removed from the SDK. In case you still need this API, please open up an issue at https://github.com/pace/cloud-sdk-ios/issues and tell us about your use case.Request has been added to all API models that are used as request body.Attributes, Relationships, Included and inner DataType have been removed from the response models.FuelingAPI.Fueling.ApproachingAtTheForecourt
let request = FuelingAPI.Fueling.ApproachingAtTheForecourt.Request(gasStationId: "SOME_ID")
// Old respone model structure until SDK version 9.x.x
API.Fueling.client.makeRequest(request) { [weak self] response in
switch response.result {
case .success(let result):
let gasStation = result.success?.included?.compactMap { $0.gasStation }.first
let gasStationAddress = gasStation?.attributes?.address
let unsupportedPaymentMethods = result.success?.data?.relationships?.unsupportedPaymentMethods
case .failure(let error):
// Some error handling
}
}
// New response model structure from SDK version 10.x.x
API.Fueling.client.makeRequest(request) { [weak self] response in
switch response.result {
case .success(let result):
let responseData = result.success?.data
let gasStation = responseData?.gasStation
let gasStationAddress = gasStation?.address
let unsupportedPaymentMethods = responseData?.unsupportedPaymentMethods
case .failure(let error):
// Some error handling
}
}
paramCount of POIKit.CommandType now returns Int? instead of IntStage environment completely. Please use Sandbox during testing and Production for everything else.currentNumberOfRetries of makeRequest(...) of FuelingAPIClient, PayAPIClient, POIAPIClient and UserAPIClient has been renamed to currentUnauthorizedRetryCount.Logger.LogLevel.verbose to Logger.LogLevel.debug.enableLogging from PACECloudSDK.Configuration.logLevel and persistLogs to PACECloudSDK.Configuration.
logLevel states the lowest Logger.LogLevel that should be logged (debug -> info -> warning -> error) or if none should be logged. Default is info.persistLogs states wether logs should be persisted into the file system. Default is false.PACECloudSDK.shared.setLogLevel(to: Logger.LogLevel) to set lowest logged Logger.LogLevel after SDK setup.PACECloudSDK.shared.persistLogs to set if logs should be persisted into files after SDK setup.POIDatabaseDelegate and POIKitObserverTokenDelegatePOIKit.UUIDNotificationToken and its respective observation functionality from POIKit.POIKitManagerloadPOIs(POIKit.BoundingBox) and loadPOIs([String]) from POIKit.POIKitManagerPOIKitObserverTokenDelegate to POIKit.POIKitManager.observe(POIKit.BoundingBox) -> POIKit.BoundingBoxNotificationToken is no longer possibleprices in POIKit.GasStationResponse is now optional2022-1 for the Pay, Fueling and POI API.
PCPayFuel does not include PCPayUnit anymore.AppKit method handleRedirectURL(URL)clientId as required property for the SDK to be set up.
clientId to the SDK setup, even if you’re not using IDKit and its default OID Configuration.OIDConfigurationClientID to your app’s Info.plist anymore in case you would like to use the default OID Configuration of IDKitPOIModelConvertible has been removed as it is no longer relevant.isOnlineCoFuGasStation of POIKit.GasStation is now a computed property, thus the setter is no longer accessible.POIKit.CofuGasStation.boundingBox(center: CLLocation, radius: CLLocationDistance) has been renamed to POIKit.CofuGasStation.boundingCircle(center: CLLocation, radius: CLLocationDistance).PCPayTollingMetadata has been removed.PCUserUserPINRequest type has been renamed to PCUserUserPINAndOTPRequestlogEvent SDK handler now includes an optional context. This context is to be used to provide a context in which the event is logged and must not be forwarded to the analytics backend.search, reverseGeocode and routing endpoints.To generate our localized strings that are part of AppKit we use SwiftGen.
Path to Strings file: PACECloudSDK/Generated/Strings.swift
Path to Localizable files: PACECloudSDK/AppKit/Localization