Posts

Post not yet marked as solved
7 Replies
687 Views
I have a swift callback function that accumulates data from the gyroscope handler CMGyroData to value, and takes care that it never goes below zero. Any thoughts why I got this crash? var value: Double = 90 func test(d: Double) { value -= d if value < 0 { value = 0 } else if value > 180 { value = 180 } // Double value cannot be converted to UInt8 because the result would be less than UInt8.min // according to Xcode, value is 0 let angle = UInt8(value.rounded()) print(angle) } During the crash, the debugger shows that value is 0, and the raw memory is 0x0000000000000000. I've heard about negative zero, but then the raw memory would be 0x8000000000000000. Either way, it makes no sense for the UInt8 constructor to fail. (lldb) p value (Double) 0 (lldb) p value.rounded() (Double) 0 (lldb) p UInt8(value.rounded()) (UInt8) 0 Xcode 15.1, iPhone 7 Plus, iOS 15.8 Edit: As a good measure, I changed that line to let angle = UInt8(Int(value.rounded()))
Posted
by gvalkov.
Last updated
.
Post not yet marked as solved
0 Replies
299 Views
Since Xcode Version 15.0 (15A240d) I can no longer use my iPhone as a network run destination. Connect via IP Address also does not work. USB works and the iPhone 7, iOS 15.7.9 is prepared for development. Restarting the iPhone or Mac Book Pro 2019 does not help. If I run Xcode 14, the phone is automatically prepared for development over the network and I can run and debug apps.
Posted
by gvalkov.
Last updated
.