ios - 应用程序崩溃并显示 [BTAlertmissAnimated :] unrecognized selector

标签 ios objective-c bluetooth crash

在我的应用程序中,我在生产中看到下面的堆栈跟踪发生了很多崩溃。

Application Specific Information:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[BTAlert dismissAnimated:]: unrecognized selector sent to instance 0x15f6d500'


Application Specific Backtrace 1:
0   CoreFoundation                      0x2f57cf03 <redacted> + 130
1   libobjc.A.dylib                     0x39d11ce7 _objc_exception_throw + 38
2   CoreFoundation                      0x2f580837 -[NSObject doesNotRecognizeSelector:] + 202
3   CoreFoundation                      0x2f57f12f <redacted> + 706
4   CoreFoundation                      0x2f4ce0d8 __CF_forwarding_prep_0 + 24
5   CoreBluetooth                       0x2f2a508f -[BTDevicePicker dealloc] + 358
6   libobjc.A.dylib                     0x39d20b6b <redacted> + 174
7   ExternalAccessory                   0x2fe93105 <redacted> + 56
8   ExternalAccessory                   0x2fe8b057 <redacted> + 898
9   CoreFoundation                      0x2f53ef39 <redacted> + 12
10  CoreFoundation                      0x2f4b2de9 __CFXNotificationPost + 1720
11  Foundation                          0x2fe9dcc5 -[NSNotificationCenter postNotificationName:object:userInfo:] + 72
12  AppSupport                          0x32f7b3f7 -[CPDistributedNotificationCenter deliverNotification:userInfo:] + 62
13  AppSupport                          0x32f7b511 __CPDNDeliverNotification + 276
14  AppSupport                          0x32f7a8a3 <redacted> + 138
15  AppSupport                          0x32f6efb3 <redacted> + 146
16  CoreFoundation                      0x2f54783f <redacted> + 34
17  CoreFoundation                      0x2f5477db <redacted> + 346
18  CoreFoundation                      0x2f545fa7 <redacted> + 1406
19  CoreFoundation                      0x2f4b07a9 _CFRunLoopRunSpecific + 524
20  CoreFoundation                      0x2f4b058b _CFRunLoopRunInMode + 106
21  GraphicsServices                    0x3441d6d3 _GSEventRunModal + 138
22  UIKit                               0x31e0f891 _UIApplicationMain + 1136
23  myapp                               0x00102647 __mh_execute_header + 30279
24  libdyld.dylib                       0x3a20fab7 <redacted> + 2

在我的应用程序中,我显示一个蓝牙选择器对话框,我猜测关闭此对话框时会发生崩溃。我自己无法重现崩溃。我用来呈现对话框的代码非常简单。

[[EAAccessoryManager sharedAccessoryManager] showBluetoothAccessoryPickerWithNameFilter:
         [NSPredicate predicateWithFormat:@"SELF CONTAINS 'MyDeviceName'"] 
         completion:^(NSError *error) {
     if (error) {
         DLog(@"Failed to search for blueetoh devices or user cancelled %@", [error localizedDescription]);
     } else {
         [self userDidConnectToBTFromInApp];
     }
}];

我的猜测是,这与调用解雇方法之前释放 BTPicker 有关 - 但这只是猜测。

我在几乎所有类型的 iPhone 或 iPad 以及几乎所有版本的 iOS 6 和 7(包括 7.1)上都见过崩溃情况。

如果有人知道为什么会发生这种情况,我很乐意听到:

最佳答案

这可能与委托(delegate)函数有关,请参阅 https://github.com/nst/iOS-Runtime-Headers/blob/master/Frameworks/CoreBluetooth.framework/BTDevicePicker.h

它试图调用我认为的那个函数。

其他可能的情况是,您正在使用 > iOs6 的方法,并且崩溃发生在 iOs 5 上。您能检查一下吗?

关于ios - 应用程序崩溃并显示 [BTAlertmissAnimated :] unrecognized selector,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22381873/

相关文章:

iphone - 在 iPhone 中记录来自蓝牙耳机的输入

java - 什么是蓝牙 uuid?我怎样才能得到它?

ios - 为 UIScrollView 子类设置缩放

ios - 自定义 UITableViewCell : programmatically trigger selection segue

ios - 如何仅比较文本中选定的字符串与 objective-c 中的给定输入

objective-c - 为什么在预设为 640x480 时使用 AVFoundation 捕获图像会给我 480x640 图像?

ios - 带有 AutoLayout 的 UITableViewCell - contentView 宽度约束失败

ios - 如何将 Voiceover 绑定(bind)到 MPVolumeView slider 中?

ios - Swift:print() 命令不打印到 Xcode 7.3.1 中的控制台

android - 如何使用 SQL 数据库在 Android 中保存从 Arduino 板接收到的数据?