HealthKit中步数获取成功,但用框架提供的API转换的时候崩了

已经取出了最近时间的步数,在Xcode上打印出来没问题,但在数据转换成可以在UI显示的时候崩了

  • (void)updateUsersFootLabel{
    HKQuantityType *footType = [HKQuantityType quantityTypeForIdentifier:HKQuantityTypeIdentifierStepCount];
    [self.healthStore aapl_mostRecentQuantitySampleOfType:footType predicate:nil completion:^(HKQuantity *mostRecentQuantity, NSError *error) {
    if (!mostRecentQuantity) {
    NSLog(@"获取步数失败,或者没有数据。");
    dispatch_async(dispatch_get_main_queue(), ^{
    self.footValueLabel.text = NSLocalizedString(@"Not available", nil);
    });
    }else{

        NSLog(@"%@",mostRecentQuantity);        //能成功获取步数
    
        double usersFoot = [mostRecentQuantity doubleValueForUnit:[HKUnit footUnit]];
    
        dispatch_async(dispatch_get_main_queue(), ^{
            self.footValueLabel.text = [NSNumberFormatter localizedStringFromNumber:@(usersFoot) numberStyle:NSNumberFormatterNoStyle];
        });
    }
    

    }];
    }

http://blog.itpub.net/29597077/viewspace-1613635/

dispatch_async(dispatch_get_main_queue(), ^{
self.footValueLabel.text = [NSNumberFormatter。。。。。。
异步派发干嘛?这是UI的设置是在主线程上的,而且double的usersFoot可能随时回收