if (this.PendingLocalUARTCreditsCount != 0) return;
this.PendingLocalUARTCreditsCount = this.MaxLocalUARTCreditsCount - this.LocalUARTCreditsCount;
IntPtr value = (IntPtr)(this.PendingLocalUARTCreditsCount);
NSData valueData = NSData.FromBytes(value, 1);
this.CbPeripheral.WriteValue(valueData, this.UartRxCreditsCharacteristic, CBCharacteristicWriteType.WithoutResponse);
Got stacktrace error with NSData valueData = NSData.FromBytes(value, 1);
Native Crash Reporting
=================================================================
Got a SIGSEGV while executing native code. This usually indicates a fatal error in the mono runtime or one of the native libraries used by your application.
=================================================================
I haven't solved it though in any way. I am developing in C# for an ipad app project using vs 2019 and a, Mac Nick
Welcome to SO ! You'd better update content all in question , then other people will know problem more clearly .
Although not knowing why NSData.FromBytes
occurs error , however there is a workaround for you to check . Using NSData.FromArray
to transfer int
to NSData
.
int valueInt = 1234567890;
Byte[] byteData = new Byte[1];
byteData[0] = (Byte)((valueInt & 0xFF));
Console.WriteLine("-----NSData-------" + NSData.FromArray(byteData));
Then output is :
-----NSData-------{length = 1, bytes = 0xd2}
Therefore , shared code can be modified as follow :
...
Byte[] byteData = new Byte[1];
byteData[0] = (Byte)((this.PendingLocalUARTCreditsCount & 0xFF));
NSData valueData = NSData.FromArray(byteData);
...
I got SIGSEGV error not SIGABRT. I can discover connect and disconnect but not set rx credits on the peripheral (using Telit 4.0 Bluetooth low, energy module) and am trying to get communication to work so don't think have to set Bluetooth permissions The problem I think is the pointer (Intpr) pointing to the wrong address as app crashes, when it deferences the data. Thanks for the input though. Regards nick
User contributions licensed under CC BY-SA 3.0