SIGABRT during deactivateAsync

edited August 2017 in iOS
I am trying to download accelerometer data from my MetaTrackr device.  When I run my function (see below), I receive a SIGABRT error in the deactivateAsync BFTask (see specifically where below).  I have reset the device, re-written this function in several different projects, but continually get this error. 

Any ideas what might be going on?


@IBAction func StopMonitoring(_sender: Any){
print("Stop Monitoring tapped")

StartMonitoringButton.isEnabled = true
StopMonitoringButton.isEnabled = false
device.led?.setLEDOnAsync(false, withOptions: 1)

device.accelerometer!.dataReadyEvent.downloadLogAndStopLoggingAsync(true)
.success{ array in self.accelerometerBMI160Data = array as! [MBLAccelerometerData]
for obj in self.accelerometerBMI160Data {
print("x: ", obj.x, ", y: ", obj.y, ", z: ", obj.z)
}
}
}



- (BFTask *)deactivateAsync
{
return [BFTask taskFromMetaWearWithBlock: ^id{
self.activateCount--;
if (self.activateCount == 0) {
activateTask = [[[self.module deactivateAsync] continueOnMetaWearWithSuccessBlock: ^id _Nullable(BFTask * _Nonnulltask) {
return [self perform AsyncDeactivation];
}] continueOnMetawearWithBlock: ^id _Nullable(BFTask* _Nonnull task) {
if(task.faulted) {
self.activateCount++;
}
return task;
}];
}
#ifdef DEBUG
assert(self.activateCount >= 0); <<<<< ERROR: "Thread12: SIGABRT"
self.activateCount = MAX(self.activateCount, 0);
return activeTask;
}];

Comments

  • Please try deleting your app from the iOS device and try again.
  • I have tried deleting the app with no change. 

    My setup:
    - StarterProject with minimal added functionality for accelerometer logging
    - iPhone 6s running iOS 10.3.3

    After a little debugging, it seems that deactivateAsync is called, but activateAsync is never called.  So activateCount becomes -1, instead of balancing out like it is supposed to.  (found in file MBLRegister.m)  

    Any ideas why activateAsync might not be called?  Or how I could call it, since it is not a function I can explicitly call?
  • In that case, this is most likely due to un-balanced calls to start/stop logging.  Double check that you are calling start/stop on the exact same event.  If you are using filters, you need to use an MBLRestorable config in order to persist the event across connect/disconnect cycles.
This discussion has been closed.