I have no real experience with Xcode or Objective-C, but am trying to help someone with a project they want to complete. They are trying to access HealthKit data from iPhone. They are trying to follow this tutorial, but getting errors from their code and can't get past it.
I've made some changes to update the code, but we keep getting an error during runtime at the end of below code:
NSArray *readTypes = @[[HKObjectType characteristicTypeForIdentifier:HKCharacteristicTypeIdentifierDateOfBirth]];
NSArray *writeTypes = @[[HKObjectType quantityTypeForIdentifier:HKQuantityTypeIdentifierBodyMass]];
[self.healthStore requestAuthorizationToShareTypes:[NSSet setWithArray:writeTypes]
readTypes:[NSSet setWithArray:readTypes]
completion:^(BOOL success, NSError *error) {
// ..
}];
Can anyone suggest what we need to do next?
The error in console:
2017-06-22 19:20:29.859703+1000 HealthBasics[7057:3757572] -[NSDateComponents timeIntervalSinceReferenceDate]: unrecognized selector sent to instance 0x170156d10 2017-06-22 19:20:29.862048+1000 HealthBasics[7057:3757572] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSDateComponents timeIntervalSinceReferenceDate]: unrecognized selector sent to instance 0x170156d10' * First throw call stack: (0x18c8dafe0 0x18b33c538 0x18c8e1ef4 0x18c8def54 0x18c7dad4c 0x18c8123f8 0x18c81231c 0x1000c61e0 0x192a41010 0x192a40f90 0x192a2b504 0x193438170 0x193437f8c 0x192fddd38 0x192fe156c 0x192b9b470 0x192a3d380 0x192fd1810 0x192fd13e0 0x192fd068c 0x192a3b70c 0x192a0c33c 0x193206014 0x193200770 0x193200b9c 0x18c88942c 0x18c888d9c 0x18c8869a8 0x18c7b6da4 0x18e220074 0x192a71058 0x1000c660c 0x18b7c559c) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)