Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EXEC_BAD_ACCESS when trying to reference controllerServiceUUID #10

Open
ds8k opened this issue Sep 21, 2021 · 1 comment
Open

EXEC_BAD_ACCESS when trying to reference controllerServiceUUID #10

ds8k opened this issue Sep 21, 2021 · 1 comment

Comments

@ds8k
Copy link

ds8k commented Sep 21, 2021

I'm trying to implement this library using a custom CMakeLists file, and seemingly I got it built and added. However when I try to run [SteamControllerManager listen], I get a bad access error in scanForControllers:

- (void)scanForControllers {
if (centralManager.state == CBManagerStatePoweredOn) {
[centralManager scanForPeripheralsWithServices:@[controllerServiceUUID] options:nil];
NSArray *peripherals = [centralManager retrieveConnectedPeripheralsWithServices:@[controllerServiceUUID]];
for (CBPeripheral *peripheral in peripherals) {
if (peripheral.state == CBPeripheralStateDisconnected) {
[connectingPeripherals addObject:peripheral];
[centralManager connectPeripheral:peripheral options:nil];
} // TODO: something if it's disconnected?
}
}
}

The culprit appears to be controllerServiceUUID. Is this a known issue, or the result of a messed up cmake file?

(edited to show the source code from the latest commit at the time the issue was posted)

@zydeco
Copy link
Owner

zydeco commented Oct 16, 2021

I'm not sure how this could happen, controllerServiceUUID is initialised with the SteamControllerManager:

- (instancetype)init {
if ((self = [super init])) {
controllerServiceUUID = [CBUUID UUIDWithString:@"100F6C32-1735-4313-B402-38567131E5F3"];
centralManager = [[CBCentralManager alloc] initWithDelegate:self queue:nil];
controllers = [NSMutableDictionary dictionaryWithCapacity:4];
connectingPeripherals = [NSMutableSet setWithCapacity:4];
}
return self;
}

Are you compiling it without ARC? What does your code look like? Do you have a stacktrace?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants