Can't connect to device: Assertion failed: (self.activateCount >= 0)
I am working on an iOS app and was able to easily connect to the devices until yesterday.
Not sure what happened (and I am using a version of code which was working perfectly earlier) but getting the error below when I try to connect to the device. The template metawear app provided by you is working fine and connects to the device.
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000}
span.s1 {font-variant-ligatures: no-common-ligatures}
Any tips on debugging this.
Thanks,
This discussion has been closed.
Comments
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #31595d; background-color: #ffffff}
p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #4f8187; background-color: #ffffff}
p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #78492a; background-color: #ffffff}
span.s1 {color: #4f8187}
span.s2 {color: #000000}
span.s3 {color: #ba2da2}
span.s4 {color: #272ad8}
span.s5 {color: #31595d}
span.s6 {color: #78492a}
- (BFTask *)deactivateAsync
{
return [BFTask taskFromMetaWearWithBlock:^id{
self.activateCount--;
if (self.activateCount == 0) {
activateTask = [[[self.module deactivateAsync] continueOnMetaWearWithSuccessBlock:^id _Nullable(BFTask * _Nonnull task) {
return [self performAsyncDeactivation];
}] continueOnMetaWearWithBlock:^id _Nullable(BFTask * _Nonnull task) {
if (task.faulted) {
self.activateCount++;
}
return task;
}];
}
#ifdef DEBUG
assert(self.activateCount >= 0);
#endif
self.activateCount = MAX(self.activateCount, 0);
return activateTask;
}];
}
return [BFTask taskFromMetaWearWithBlock:^id{
***** if (self.activateCount > 0 ) { ********
self.activateCount--;