2011-07-31 50 views
1
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' 

实际代码:崩溃发送到类

BluetoothDeviceAddress addr; 
IOBluetoothNSStringToDeviceAddress(selectedBTDeviceSerial, &addr); 
actualBTDevice = [[IOBluetoothDevice alloc] init]; 
actualBTDevice = [IOBluetoothDevice deviceWithAddress:&addr]; 

如何解决,或让他重新安装系统IOBluetooth东西,任何想法?

回答

2

+[IOBluetoothDevice deviceWithAddress:]在Mac OS X v10.7 SDK中引入。早期的OS X版本改为提供+[IOBluetoothDevice withAddress:]。你应该能够做这样的事情:

if ([[IOBluetoothDevice class] respondsToSelector:@selector(deviceWithAddress:)]) 
    actualBTDevice = [IOBluetoothDevice deviceWithAddress:&addr]; 
else 
    actualBTDevice = [IOBluetoothDevice withAddress:&addr]; 

此外,你泄露你实例化对象与

actualBTDevice = [[IOBluetoothDevice alloc] init]; 

因为你立即指派另一个目的是变量。