2011-07-30 18:59:33.545 TokenLock[481:903] +[IOBluetoothDevice deviceWithAddress:]: unrecognized selector sent to class 0x7fff70c18cf8
2011-07-30 18:59:33.546 TokenLock[481:903] An uncaught exception was raised
2011-07-30 18:59:33.547 TokenLock[481:903] +[IOBluetoothDevice deviceWithAddress:]: unrecognized selector sent to class 0x7fff70c18cf8
2011-开发者_开发知识库07-30 18:59:33.548 TokenLock[481:903] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[IOBluetoothDevice deviceWithAddress:]: unrecognized selector sent to class 0x7fff70c18cf8'
Actual code:
BluetoothDeviceAddress addr;
IOBluetoothNSStringToDeviceAddress(selectedBTDeviceSerial, &addr);
actualBTDevice = [[IOBluetoothDevice alloc] init];
actualBTDevice = [IOBluetoothDevice deviceWithAddress:&addr];
Any ideas on how to troubleshoot, or have him reinstall the IOBluetooth system stuff?
+[IOBluetoothDevice deviceWithAddress:]
was introduced in the Mac OS X v10.7 SDK. Earlier OS X versions provide +[IOBluetoothDevice withAddress:]
instead. You should be able to do something like:
if ([[IOBluetoothDevice class] respondsToSelector:@selector(deviceWithAddress:)])
actualBTDevice = [IOBluetoothDevice deviceWithAddress:&addr];
else
actualBTDevice = [IOBluetoothDevice withAddress:&addr];
Also, you’re leaking the object you’re instantiating with
actualBTDevice = [[IOBluetoothDevice alloc] init];
since you’re immediately assigning another object to that variable.
精彩评论