いつものように開発で引っかかったところのメモです。
環境
- Xcode 11.3 (11C29)
- iOS 13.3
- watchOS 6.1.1
今までは
healthStore_ = [[HKHealthStore alloc] init];
HKQuantityType *type = [HKQuantityType quantityTypeForIdentifier:HKQuantityTypeIdentifierHeartRate];
HKQuantityType *type2 = [HKQuantityType quantityTypeForIdentifier:HKQuantityTypeIdentifierDistanceWalkingRunning];
HKQuantityType *type3 = [HKQuantityType quantityTypeForIdentifier:HKQuantityTypeIdentifierActiveEnergyBurned];
[healthStore_ requestAuthorizationToShareTypes:nil readTypes:[NSSet setWithObjects:type, type2, type3, nil] completion:^(BOOL success, NSError * _Nullable error) {
if (success) {
NSLog(@"health data request success");
}else{
NSLog(@"error %@", error);
}
}];
という感じでWorkout Sessionの為のHKHealthStore を準備できたのですが、Xcode11になってから、
- NSHealthShareUsageDescription
- NSHealthUpdateUsageDescription
をinfo.plistに設定していて、かつ、ちゃんとdescriptionを(エンタープライズアプリであろうと)書いてあげないと、watchアプリがクラッシュするようになりました。
watchアプリやってる人少ないんでしょうけど、、、気をつけましょうね。