This is the way I wound up doing it. I'm saving it in a text file in the documents directory. Not the prettiest solution (I much preferred being able to persist it as an Int, though I'm sure Apple has their reasons for not allowing it), but it works.
For those who are curious, the code I settled on looks like this:
+ (nullable HKQueryAnchor *)hkAnchor {
NSURL *url = [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
NSString *filePath = [url.path stringByAppendingPathComponent:@"hkAnchor.txt"];
HKQueryAnchor *anchor = [NSKeyedUnarchiver unarchiveObjectWithFile:filePath];
return anchor;
}
+ (void)setHKAnchor:(HKQueryAnchor *)anchor {
NSURL *url = [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
NSString *filePath = [url.path stringByAppendingPathComponent:@"hkAnchor.txt"];
[NSKeyedArchiver archiveRootObject:anchor toFile:filePath];
}
Thanks for the help, and best of luck.