CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate Alamofire into your Xcode project using CocoaPods, specify it in your Podfile
:
pod 'ApsisOne', '~> 0.8'
The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift
compiler.
To install AppTool package into your packages, add it to the dependencies
value of your Package.swift
:
dependencies: [
.package(url: "https://github.com/ApsisInternational/apptool-ios-sdk.git", .upToNextMajor(from: "0.8.1"))
]
To install AppTool package via Xcode
- Go to File -> Swift Packages -> Add Package Dependency...
- Then search for https://github.com/ApsisInternational/apptool-ios-sdk.git
- And choose the version you want
To start collecting and sending any events like users’ behaviour data, custom events which you implement, location tracking, etc. You should provide data collection consent using provideConsent: method
Objective-C
[ApsisOneAPI provideConsent:ONEConsentTypeCollectData];
Swift
ApsisOneAPI.provide(.collectData)
To track user’s location data:
- Add description of location collection in Info.plist file
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Track Your location to improve something</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Track Your location to improve something</string>
- Your app should request user’s authorization to use location services using ordinary CLLocationManager API (Preferred to use requestAlwaysAuthorization in case to collect location data in background):
Objective-C
[CLLocationManager.new requestAlwaysAuthorization];
Swift
CLLocationManager().requestAlwaysAuthorization()
- In addition to data collection consent, you should provide location collection consent using provideConsent: method
Objective-C
[ApsisOneAPI provideConsent:ONEConsentTypeCollectLocation];
Swift
ApsisOneAPI.provide(.collectLocation)
To let framework collecting location in background, even application was closed, add location to allowed background modes in Info.plist
<key>UIBackgroundModes</key>
<array>
<string>location</string>
</array>
or Target -> Signing & Capabilities -> Background modes -> Location updates
To allow sending push notifications you have to subscribe on topics using subscribePushNotificationTopics: method e.g.:
Objective-C
[ApsisOneAPI subscribePushNotificationTopics:@[@"some.consent.topic.discriminator"]];
Swift
ApsisOneAPI.subscribePushNotificationTopics(["some.consent.topic.discriminator"])
To stop receiving topic notifications use unsubscribe method, e.g.:
Objective-C
[ApsisOneAPI unsubscribePushNotificationTopics:@[@"some.consent.topic.discriminator"]];
Swift
ApsisOneAPI.unsubscribePushNotificationTopics(["some.consent.topic.discriminator"])
If there was no request for user's permission for push notifications yet, SDK will ask user for permission on first subscription call.
To let framework process and show notification add remote-notification to allowed background modes in Info.plist
<key>UIBackgroundModes</key>
<array>
<string>remote-notification</string>
</array>
or Target -> Signing & Capabilities -> Background modes -> Remote Notifications
Documentation for the project can be found here