Error while authorization to HealthKit - Code=100 "Rolling back the health database is unsupported."

Here is my code:

    var shareTypes = Set<HKSampleType>()
    shareTypes.insert(HKSampleType.categoryType(forIdentifier: .mindfulSession)!)

    var readTypes = Set<HKObjectType>()
    readTypes.insert(HKObjectType.categoryType(forIdentifier: .mindfulSession)!)

    healthStore.requestAuthorization(toShare: shareTypes, read: readTypes) { (success, error) -> Void in
        if success {
            print("success")
        } else {
            print("failure")
        }

        if let error = error { print(error) }
    }

Here I get error: Error Domain=com.apple.healthkit Code=100 "Rolling back the health database is unsupported."

Cant find any information about this error, can anybody help?

I use Xcode 8.3.3 Swift 3

Upvotes: 0

Views: 305

Answers (1)

Allan
Allan

Reputation: 7363

This indicates that you had a newer version of iOS installed on this device previously and then you rolled back to an older version. In general, rolling back is not supported accross iOS (although some parts of the system can handle it better than others). You should always erase a device before installing an older OS on it.

Upvotes: 1

Related Questions