iOS8如何在iPad Air上使用HealthKit时修复"此设备上的健康数据不可用"

Ale*_*one 2 objective-c ipad ios8 healthkit

我正试图从WWDC 2014运行"Fit"示例来查看HealthKit.我正在使用iPad air更新到iOS8 beta3.但是,输入任何信息时,应用程序崩溃并显示错误:

Error Domain=com.apple.healthkit Code=1 "Health data is unavailable on this device"
Run Code Online (Sandbox Code Playgroud)

这是产生错误的方法的示例

    - (void)saveHeightIntoHealthStore:(double)height {
        // Save the user's height into HealthKit.
        HKUnit *inchUnit = [HKUnit inchUnit];
        HKQuantity *heightQuantity = [HKQuantity quantityWithUnit:inchUnit doubleValue:height];

        HKQuantityType *heightType = [HKQuantityType quantityTypeForIdentifier:HKQuantityTypeIdentifierHeight];
        NSDate *now = [NSDate date];

        HKQuantitySample *heightSample = [HKQuantitySample quantitySampleWithType:heightType quantity:heightQuantity startDate:now endDate:now];

        [self.healthStore saveObject:heightSample withCompletion:^(BOOL success, NSError *error) {
            if (!success) {

//Error reported here

                NSLog(@"An error occured saving the height sample %@. In your app, try to handle this gracefully. The error was: %@.", heightSample, error);
                abort();
            }
            [self updateUsersHeight];
        }];
    }
Run Code Online (Sandbox Code Playgroud)

que*_*ish 9

HealthKit不适用于iPad,只有iPhone和iPod - 就像Passbook一样.