我发现maxConcurrentOperationCount=1并不管用 虽然网上搜到一大堆说添加依赖能解决问题 但现实中有如下api
CMStepCounter ios8苹果计步器
-
(void)queryStepCountStartingFrom:(NSDate *)start
to:(NSDate *)end toQueue:(NSOperationQueue *)queue withHandler:(CMStepQueryHandler)handler;
和CMMotionManager中方法
(void)startDeviceMotionUpdatesToQueue:(NSOperationQueue *)queue withHandler:(CMDeviceMotionHandler)handler
都是异步回调的
怎么实现如下功能
for(int i = 0; i< 24 ;i ++)
{
[_stepCounter queryStepCountStartingFrom:fromDate
to:toDate
toQueue:_timeQueue
withHandler:^(NSInteger numberOfSteps, NSError *error)
{
}
}
按顺序取出
maxConcurrentOperationCount肯定是管用的,一步接口串行之行,你要在收到回调后发送时间(条件变量,信号等)