在一台用户 10.6.8 机器上崩溃,并将无法识别的选择器发送到班级

发布于 2024-11-27 15:37:32 字数 897 浏览 1 评论 0原文

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 系统的东西有什么想法吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我也只是我 2024-12-04 15:37:32

+[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];

因为您立即将另一个对象分配给该变量。

+[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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文