Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
The attached sample throws an exception and crashes with "[__NSCFType data] unrecognized selector sent to instance"
**Steps to Reproduce:**
1. Download the sample here: http://developer.xamarin.com/content/BluetoothLEExplorer/BluetoothLEExplorer.zip
2. Run on a device.
3. Press Start to start the scan
**Build Date & Platform:**
I'm unable to reproduce this.
Can you attach the complete stack trace / crash report?
I have checked this issue but I am unable to reproduce this issue.
Steps I followed:
1. Set iOS project as "Startup Project"
2. Run the attached folder on device
3. Tap the scan button.
When I tap the "Scan" button I observed that application is working fine without any error or crashes.
Please let me know if I am missing something ?
Mac OS X 10.9.5
Xamarin Studio: 5.6.1 (build 5)
Mono 3.10.0 ((detached/633e444)
GTK+ 2.24.23 (Raleigh theme)
Xcode 6.0.1 (6528)
Xamarin.iOS : 188.8.131.52 (Business Edition)
=== Build Information ===
Release ID: 506010005
Git revision: 4a603dc77610b9eff2a41582146c56b69a81ceba
Build date: 2014-10-09 11:07:06-04
In the sample, it crashes on this line:
> // ScannerHome.cs Line 144
> cell.DetailTextLabel.Text = "UUID: " + peripheral.UUID.ToString () + ", Signal Strength: " + peripheral.RSSI;
>[__NSCFType data]: unrecognized selector sent to instance 0x1469e6e0
>2014-10-14 08:58:04.680 XamarinRoboticsBluetoothLEExploreriOS[4268:1761271] Unhandled managed exception: Objective-C exception thrown. Name: NSInvalidArgumentException Reason: -[__NSCFType data]: unrecognized selector sent to instance 0x1469e6e0 (MonoTouch.Foundation.MonoTouchException)
> at (wrapper managed-to-native) MonoTouch.ObjCRuntime.Messaging:IntPtr_objc_msgSend (intptr,intptr)
> at MonoTouch.CoreBluetooth.CBUUID.get_Data () [0x00003] in /Developer/MonoTouch/Source/monotouch/src/build/compat/CoreBluetooth/CBUUID.g.cs:139
> at MonoTouch.CoreBluetooth.CBUUID.ToString (Boolean fullUuid) [0x00000] in /Developer/MonoTouch/Source/maccore/src/CoreBluetooth/CBUUID.cs:168
> at MonoTouch.CoreBluetooth.CBUUID.ToString () [0x00000] in /Developer/MonoTouch/Source/maccore/src/CoreBluetooth/CBUUID.cs:49
> at BluetoothLEExplorer.iOS.UI.Screens.Scanner.Home.ScannerHome+BleDeviceTableSource.GetCell (MonoTouch.UIKit.UITableView tableView, MonoTouch.Foundation.NSIndexPath indexPath) [0x00066] in /Users/johnmiller/Downloads/BluetoothLEExplorer/BluetoothLEExplorer.iOS/UI/Screens/Scanner/Home/ScannerHome.cs:144
> at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string,intptr,intptr)
> at MonoTouch.UIKit.UIApplication.Main (System.String args, IntPtr principal, IntPtr delegate) [0x00005] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:62
> at MonoTouch.UIKit.UIApplication.Main (System.String args, System.String principalClassName, System.String delegateClassName) [0x0001c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:45
> at BluetoothLEExplorer.iOS.Application.Main (System.String args) [0x00008] in /Users/johnmiller/Downloads/BluetoothLEExplorer/BluetoothLEExplorer.iOS/Main.cs:16
That code is not hit without an BLE device. Seems all I got are BL devices around :| maybe I need to buy more gadgets...
OTOH I seem to have found 2 bugs (one compiler and another one related to null handling) in the test case.
Confirming bug using an Estimote iBeacon.
The issue is that the bridge between CFUUIDRef and CBUUID is not toll-free. The workaround for this is:
var uuid = CBUUID.FromCFUUID (peripheral.UUID.Handle);
cell.DetailTextLabel.Text = "UUID: " + uuid.ToString () + ", Signal Strength: " + peripheral.RSSI;
There is also a more obscure problem and I cannot understand where it is coming for. It regards the RSSI signal. In the sample you are trying if I am not mistaking is always 0 even after calling ReadRSSI method. Anyway in another application I am building with Xamarin for iOS at some point in time I am not receiving the RssiUpdated event from any device connected inside my application. All ReadRSSI methods don't trigger the event and the Device.RSSI is always 0. Here is the strange part: if I disable the bluetooth and enable it the RSSI part starts working again. Another thing if it helps when inside my application the RSSI part doesn't work if I launch other applications that can manage BLE devices like LightBlue I can actually see the RSSI values.
Any idea where is it coming from?
This (original) bug is being closed as it is fixed in maccore (c55b599254f46c083a27ff7376a397ecc876a74d).
Regarding the ReadRSSI, could you please open another bug so we can triage it properly?