Adonit/Adonit-iOS-SDK

Accessing `totalNumberOfStylusesConnected` deadlocks the current thread

Closed this issue · 1 comments

Using the latest version of the SDK (version 3.2), apps appear to lock up indefinitely when accessing the totalNumberOfStylusesConnected property of the shared JotStylusManager instance.

As an example, add this code:

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
    NSLog(@"About to access .totalNumberOfStylusesConnected");
    NSLog(@"totalNumberOfStylusesConnected: %d", self.jotManager.totalNumberOfStylusesConnected);
    NSLog(@"Finished accessing .totalNumberOfStylusesConnected");
});

to the end of the setupJotSDK method in the sample app. The app will output the first NSLog line, but hang and never output the second or third lines.

Tested on an iPad 3, with a Jot Script. Though the issue even occurs with Bluetooth turned off.

Thank you Dave for your catch.
It seems the totalNumberOfStylusesConnected property is indeed not working as intended.
We will fix this in our next release. But momentarily, you can consider using isStylusConnected if your objective is to know whether a stylus is connected or not at a particular time.
By design, our SDK currently allows only one stylus connection at a time.