Assertion failed: (self.activateCount >= 0)

I am getting the following suddenly:

Assertion failed: (self.activateCount >= 0), function __30-[MBLRegister deactivateAsync]_block_invoke, file /Users/dad/Dropbox/Projects/mbient/MetaWear-SDK-iOS-macOS-tvOS-master/MetaWear/Classes/Core/MBLRegister.m, line 561.

I had been having a few app crashes due to some errors and then this started showing up. I have done a Build Clean with no effect.

_activate_count is -1 at that time.

The error is repeatable, I cannot seem to get past it.

I have attached to the device with MetaBase on my iPhone and that connects OK but the MacOS app that I am testing with does not. The app is based on the StarterProject. I have added to it so that after the connection it segues into a new view with some readouts. I have backed the app up to the state where it was working fine and that is failing too.

Any assistance locating the problem would be appreciated.


  • I have connected via the iOS apps, MetaWear and MetaBase and they connect and work fine. I have tried a reset to factory but that has not affected my assertion failure.
  • Found it!

    Something in "~/Library/Application Support/com.mbientlab.metawear.devices/" was messed up. Removing that directory let the app continue.
  • edited March 2017
    For a little additional information, the MetaWear SDK caches quite a bit of device state on the iPhone (in the directory you mentioned).  When running in debug mode it is sometimes possible (but quite rare) to get this cache corrupted with some unexpected API calls or unexpected app terminations (hitting the stop button).  

    You can just delete and reinstall the app, or delete that specific folder if needed.
This discussion has been closed.