# iOS Changelog
## Version 8.1.2 *(2026-10-07)*

- Fixed: an issue where setting a new `userToken` would not reliably trigger a transmission of pending events.

## Version 8.0.0 *(2026-09-08)*

- Changed: `initialize(using delegate: MotionTagDelegate, launchOptions: [UIApplication.LaunchOptionsKey : Any]?)` now `throws`. It throws `MotionTagInitializationError` if the SDK's local storage (Core Data persistent store or Keychain) could not be set up, or if the host app's `Info.plist` is missing a required background mode or `BGTaskSchedulerPermittedIdentifiers` entry. Wrap the call in a `do`/`catch` in your `AppDelegate`.

## Version 7.0.0 ** (2026-07-02)

- Improved: Adopt Swift 6 language and its concurrency model.
- Changed: Renamed `MotionTagDelegate` methods:
    - `trackingStatusChanged(_ isTracking: Bool)` → `trackingDidChange(isTracking: Bool)`
    - `locationAuthorizationStatusDidChange(_ status: CLAuthorizationStatus, precise: Bool)` → `locationAuthorizationDidChange(status: CLAuthorizationStatus, isPrecise: Bool)`
    - `motionActivityAuthorized(_ authorized: Bool)` → `motionActivityAuthorizationDidChange(isAuthorized: Bool)`
    - `didTrackLocation(_ location: CLLocation)` → `didUpdateLocation(_ location: CLLocation)`
    - `dataUploadWithTracked(from startDate: Date, to endDate: Date, didCompleteWithError error: Error?)` → `dataUploadDidComplete(from startDate: Date, to endDate: Date, error: Error?)`

## Version 6.5.0 *(2026-04-14)*

- Fixed: Fix an issue with data transmission in special cases.
- Changed: `Permitted background task scheduler identifiers` in your app's info.plist is now required for faster publishing of storylines. Please check section 9 of the documentation for more details.

## Version 6.3.6 *(2025-10-14)*

- Improved: Enabled faster publishing of storylines.

## Version 6.3.4 *(2025-07-24)*

- Improved: Consistency of SDK lifecycle events.
- Improved: Made adjustments to Core Data store configuration behavior.
- Improved: Added more crash messages during Core Data setup for improved diagnostics.
- Added: Debugging events for location accuracy.

## Version 6.3.1 *(2025-05-08)*

- Improved: Fixed an issue with data transmission.

## Version 6.3.0 *(2025-04-29)*

- Added: Optimized transmission logic for short-lived token payloads to reduce latency and enhance reliability.

## Version 6.2.1 *(2025-01-13)*

- Changed: Renamed `func` `handleEvents(forBackgroundURLSession: identifier, completionHandler: completionHandler)` to `processBackgroundSessionEvents(with identifier: String, completionHandler: @escaping () -> Void)`.
- Changed: Updated `func clearData() -> Int` to replace the previous implementation `clearData(completionHandler: @escaping () -> Void)`.
- Improved: Thorough error message reporting on the delegate method `func dataUploadWithTracked(from startDate: Date, to endDate: Date, didCompleteWithError error: Error?)`.

## Version 5.2.0 *(2024-08-26)*

- Improved: Enhanced collection and upload of data.
- Removed: `isLocationServicesEnabled` property.

## Version 5.1.7 *(2024-04-01)*

- Fixed: Occasional incomplete transmission on switching off tracking. 

## Version 5.1.1 *(2024-02-16)*

- Added: Swift Package Manager (SPM) support.

## Version 5.0.5 *(2023-10-16)*
 
- Improved: Load the CoreData layer asynchronously.
- Improved: Maintain the original device id on a different JWT, if it's on the same UUID.
- Added: Beacon monitoring for certain clients, requiring the `NSBluetoothAlwaysUsageDescription` in your app's Info.plist.

## Version 5.0.0 *(2022-10-17)*

- Added: `hasRequiredPermissions: Bool { get }`. True when both location services are enabled and app location permissions are authorized.
- Added: `isLocationServicesEnabled: Bool { get }`. True when location services are enabled.
- Added: `version: String { get }`. SDK version.
- Removed: `delegate` property setter/getter.
- Changed: The SDK **must** be initialized by calling the new ```initialize(using delegate: MotionTagDelegate, launchOption launchOptions: [AnyHashable : Any]?)``` function.<br>
    The initialization should still happen somewhere near the top of ```didFinishLaunchingWithOptions``` App's delegate.
    Calling any other SDK function or property prior to its initialization will result in an error.
- Changed: `func trackingStatusChanged(_ isTracking: Bool)`<br> and `func locationAuthorizationStatusDidChange(_ status: CLAuthorizationStatus, precise: Bool)` methods of the `MotionTagDelegate` are required. Also, both are called upon initialization.
- Changed: `userToken` is an optional since it's initially nill before setting. Not setting it with a valid JWT token will cause a transmission failure.
- Changed: `wifiOnlyDataTransfer` is now false by default.

## Version 4.3.1 *(2022-08-16)*

- Improved: Add SDK to CocoaPods trunk. Simply do: pod 'MotionTagSDK'. No need for the github link.
- Changed: Increase minimum target version to 12.3

## Version 4.3.0 *(2022-02-24)*

- Improved: Improve the accuracy of detected stays
- Fixed: Fix a rare crash during the background data transmission

## Version 4.2.1 *(2022-02-03)*

- Added: Apple Silicon build for iOS simulator

## Version 4.2.0 *(2021-11-17)*

- Fixed: Fix [an issue](https://developer.apple.com/forums/thread/690647) where Xcode 13 archiving process would wrongly overwrite the SDK's internal version and build numbers. 
    - We *recommend* Xcode 13 users to update to SDK 4.2.0 or later, or disable the "Manage Version and Build Number" in Xcode. If you use fastlane, you can set `manageAppVersionAndBuildNumber` to `false`.
- Fixed: Fix an edge case where tracking is switched off after revoking location authorization  

## Version 4.1.0 *(2021-10-12)*

- Improved: Reduce gaps in the detected stays
- Fixed: Fix an issue that could prevent data from being transmitted after the app is migrated to a new iPhone
- Fixed: Fix rare crashes during the data transmission

## Version 4.0.0 *(2021-08-09)*

- Changed: The `useWifiOnlyDataTransfer` method has been replaced by property `wifiOnlyDataTransfer`. 
- Changed: The token parameter has been dropped from the `start` method. 
- Changed: The `sharedInstance(...)` method has been changed to a property.
- Changed: Delegate `didTransmitData(_ transmissionTimestamp: Date, lastEventTimestamp: Date)` is replaced with `dataUploadWithTracked(from startDate: Date, to endDate: Date, didCompleteWithError error: Error?)`, 
showing the timestamp of the earliest and latest events in the batch, as well as any possible transmission errors.
- Added: Property `userToken` that allows updating the user JWT during runtime (e.g.: when the token expires). The provided token will be persisted in the SDK and must be provided before calling the `start()` method. 
This property can also be used to retrieve the set token.
- Removed: The settings dictionary has been dropped altogether.
- Removed: The battery saving mode option has been removed. Battery saving mode is always enabled now.
- Removed: The `isTrackingActiveAsInt` property has been dropped.
- Fixed: Fix background task leak.

[This commit](https://github.com/MOTIONTAG/motiontag-sample-app-ios/commit/daab468864804009cebea64135e0323f3b4c84c0) in the sample app repository demonstrates how to update from version 3.x.x to 4.0.0.

## Version 3.2.0 *(2021-06-14)*

- Improved: Reduce battery consumption and data transmission volume.
- Improved: Automatically resume tracking when location permission or location services are restored.
- Improved: Immediately trigger the creation of user in our backend after starting the SDK.

## Version 3.1.1 *(2021-06-04)*

- Fixed: Fix an issue with the Motion & Fitness permission dialog popping up.
- Fixed: Fix a crash that occurred on stop, followed by start with a different DataTransmissionMode in rapid succession.

## Version 3.1.0 *(2021-05-03)*

- Changed: The MotionTagSDK cocoapods releases are now being hosted on a public GitHub repository.
  Please update your `Podfile` as follows: `pod 'MotionTagSDK', :git => 'https://github.com/MOTIONTAG/motiontag-sdk-ios-releases.git'`.
- Added: Method to delete all tracked data from the local database.
- Deprecated: The `kMTBatterySavingsMode` SDK setting has been deprecated and will be removed in the future.
- Fixed: Fix a bug that could prevent the SDK from transmitting data when using the iOS Simulator.
- Fixed: Fix a bug that could cause duplication of `Connectivity` events.

## Version 3.0.1 *(2021-04-23)*

- Fixed: Fix a `NSURLBackgroundSession` crash when updating the SDK.

## Version 3.0.0 *(2021-04-09)*

- Changed: The SDK is now initialized synchronously.
- Changed: The SDK can be initialized later after the client onboarding.
- Changed: The AppDelegate's ```handleEventsForBackgroundURLSession``` call must be forwarded to the SDK. Please check the "Setup" section of the documentation for more details.
- Changed: The JWT does not have to be provided during the SDK's initialization anymore, only when starting tracking.
- Improved: Transmit all data collected after stopping tracking.
- Fixed: Fix a bug that could prevent the SDK from correctly waking up.

## Version 2.3.0 *(2021-02-01)*

- SDK will start again after restoring location authorization

## Version 2.2.0 *(2020-11-09)*

- Remove location and Motion&Fitness authorization requests
- Add delegate for tracking status change
- Update the location authorization status change delegate with the iOS 14 'Precise Location'
- Add delegate for Motion&Fitness authorization status

## Version 1.9.5 *(2020-10-09)*

- Performance and energy consumption improvements

## Version 1.8.4 *(2020-09-26)*

- Continue to function (with increased battery consumption), when Motion & Fitness permission denied

## Version 1.8.0 *(2020-09-22)*

- Remove arm64 from simulator build (Needs cocoapods version >= 1.10.0.rc.1)
- Further reduce data transmission rate

## Version 1.7.14 *(2020-09-21)*

- Fix archiving process on Xcode 12

## Version 1.7.6 *(2020-09-18)*

- Fix SDK delegate not being called when using Xcode 12

## Version 1.7.3 *(2020-09-04)*

- Enhanced accuracy in rural regions, improved wake-up after leaving a stay, and substantial reduction in data transmission.

## Version 1.6.0 *(2020-07-06)*

- Fix an issue that prevented data transmission in certain cases

## Version 1.5.8 *(2020-03-17)*

- Reduce data transmission substantially

## Version 1.5.6 *(2020-03-06)*

- Restart tracking on app update

## Version 1.4.5 *(2019-11-07)*

- Fix a bug that prevented mode of sending changes

## Version 1.4.0 *(2019-10-25)*

- Reduce battery consumption
- Reduce the ammount of data transmitted
- Fix a bug that caused delayed storylines

## Version 1.3.0 *(2019-10-14)*

- Update didTransmitData with the timestamp of the last event transmitted

## Version 1.2.5 *(2019-10-11)*

- Fix crashes

## Version 1.2.0 *(2019-09-17)*

- Full support for iOS 13

## Version 1.1.3 *(2019-09-12)*

- Further modifications to support iOS 13

## Version 1.1.2 *(2019-09-12)*

- Removed the internal automatic 'always' location authorization request when staring the SDK

## Version 1.1.1 *(2019-09-11)*

- Fixed a bug that caused sending of acquired data before the SDK had been initialized
- Fixed a bug that would pop a motion authorization dialog

## Version 1.1.0 *(2019-09-05)*

- Remove background fetch capability requirement
- Fix all known bugs

## Version 0.6.1 *(2019-07-09)*

- Remove beacon monitoring
