应用程序崩溃[BTAlert dismissAnimated:]无法识别的选择器

时间:2014-03-13 14:33:50

标签: 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];
     }
}];

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

我已经看到几乎任何类型的iPhone或iPad,以及几乎任何版本的iOS 6和7(包括7.1)的崩溃。

如果有人知道为什么会这样,我会很高兴听到它:

1 个答案:

答案 0 :(得分:0)

它可能与委托功能有关,请参阅https://github.com/nst/iOS-Runtime-Headers/blob/master/Frameworks/CoreBluetooth.framework/BTDevicePicker.h

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

可能的其他方面是您使用的方法是&gt; iOs6,崩溃发生在iOs 5上。你能检查一下吗?