OCMock Core Bluetooth

Discussion of the OCMock framework. If you have patches we would prefer you to send them to the mailing list, but attaching them to a topic is possible, too.

OCMock Core Bluetooth

Postby mumensh » 18 Feb 2017, 11:54


I'm trying to build tests for my application which use core bluetooth, whenever I'm trying to create a test for a class that call core bluetooth class (which is a singleton class), I've got the following runtime error: "failed: caught "NSInternalInconsistencyException", "State restoration of CBCentralManager is only allowed for applications that have specified the "bluetooth-central" background mode""

How could I make it work, I've tried to stub the singleton sharedInstance method but still, it calls the initialization of the core bluetooth class and the error raise.

Return to OCMock