尝试访问Healthkit时containerAppExtensionEntitlementsWithCompletion错误

时间:2018-07-04 03:09:03

标签: swift xcode watchkit apple-watch health-kit

我试图通过以下操作在我的应用程序中使用healthKit进行身份验证:

    let healthStore = HKHealthStore()

    let typesToShare: Set = [
        HKQuantityType.workoutType()
    ]

    let typesToRead: Set = [
        HKQuantityType.quantityType(forIdentifier: .heartRate)!,
        HKQuantityType.quantityType(forIdentifier: .activeEnergyBurned)!,
        HKQuantityType.quantityType(forIdentifier: .distanceWalkingRunning)!
    ]

    healthStore.requestAuthorization(toShare: typesToShare, read: typesToRead) { (success, error) in
        // handle error
    }

出现以下通知:

Image requesting user to open application to accept health data

但是,当应用程序打开并且我在控制台中收到以下错误时,访问healthKit的请求永远不会出现在用户的设备上:

ChangApp WatchKit Extension[72042:4030925] [default] containerAppExtensionEntitlementsWithCompletion: failed with error: (null)

0 个答案:

没有答案