草庐IT

ble-state-preservation

全部标签

swift - 将 didSet 添加到 @State var 后如何修复 Xcode 错误 "Segmentation fault: 11"

我想向SwiftUI的View结构的参数添加一个“didSet”函数,但每次我尝试构建应用程序时,我都会收到“段错误:11”错误。我尝试重命名参数,但没有任何反应。我也尝试将其设置为Optional,但因为它是@State,所以没有用。我能做什么?@Statevartext:String{didSet{print(oldValue,text)}} 最佳答案 尝试为您的var添加一个默认值,这在定义@Statevar时是必需的。@Statevartext:String=""{didSet{print(oldValue,text)}}

安卓 BLE API : GATT Notification not received

用于测试的设备:Nexus4、Android4.3连接工作正常,但我的回调的onCharacteristicChanged方法从未被调用。但是,我正在使用onServicesDiscovered内的setCharacteristicNotification(char,true)注册通知,该函数甚至返回true。设备日志(当通知应该出现/通过蓝牙设备发送时,实际上根本没有没有消息):07-2818:15:06.93616777-16809/de.ffuf.leica.sketchD/BluetoothGatt:setCharacteristicNotification()-uuid:3a

安卓 BLE API : GATT Notification not received

用于测试的设备:Nexus4、Android4.3连接工作正常,但我的回调的onCharacteristicChanged方法从未被调用。但是,我正在使用onServicesDiscovered内的setCharacteristicNotification(char,true)注册通知,该函数甚至返回true。设备日志(当通知应该出现/通过蓝牙设备发送时,实际上根本没有没有消息):07-2818:15:06.93616777-16809/de.ffuf.leica.sketchD/BluetoothGatt:setCharacteristicNotification()-uuid:3a

ios - BLE Swift 写入特性

我正在努力让我的TIsensortag温度传感器发出通知。根据http://processors.wiki.ti.com/images/a/a8/BLE_SensorTag_GATT_Server.pdf我需要将UUIDF000AA02-0451-4000-B000-000000000000的特征值设置为“01:00”。这是我所做的:importUIKitimportCoreBluetoothclassViewController:UIViewController,CBCentralManagerDelegate,CBPeripheralDelegate{varcentralManag

ios - 在 iOS Swift 中写入 BLE 接收器

我是iOS和BLE的新手。我一直在按照教程连接并将数据发送到Arduino上的BLE接收器板。本教程是为不同的板设计的,我正在使用(如果可能有帮助,BLE板是Adafruitnrf8001)。以下代码设置UUID...让BLEServiceUUID=CBUUID(string:"6E400001-B5A3-F393-E0A9-E50E24DCCA9E")让PositionCharUUID=CBUUID(字符串:“6E400002-B5A3-F393-E0A9-E50E24DCCA9E”)让BLEServiceChangedStatusNotification="kBLEServiceC

iOS Metal : Unable to create compute pipeline state with function

我正在尝试使用iOSMetalFramework在GPU上制作一个简单的数独应用程序。我按照这篇博文的说明操作:http://memkite.com/blog/2014/12/15/data-parallel-programming-with-metal-and-swift-for-iphoneipad-gpu/我在这里对我的代码进行版本控制:https://github.com/mateuszbuda/Sudoku(在写这个问题时HEAD是提交c3e06e0)我在调用时遇到了错误newComputePipelineStateWithFunction那是在ViewController中

swift - 如何在 Swift 中读取 BLE 特征 float

我正在尝试连接到蓝牙LE/蓝牙智能/BLE健康设备的健康温度计服务(0x1809),如此处的官方描述:https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=org.bluetooth.service.health_thermometer.xml.具体来说,我正在请求来自健康温度计特征(0x2A1C)的通知,并在此处进行说明:https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=

ios - iOS取消BLE外设连接后无法重连

在我的项目中,我成功地连接到蓝牙LE外围设备并从该设备读取CBCharacteristic值。我面临一个问题。如果用户愿意,我需要断开外围设备并重新连接设备。我正在使用以下步骤。1。对于断开连接:我打电话centralManager?.cancelPeripheralConnection(外设)。此调用成功完成调用委托(delegate)funccentralManager(central:CBCentralManager,didDisconnectPeripheralperipheral:CBPeripheral,error:NSError?)2。重新连接:我开始扫描外围设备,就像我

ios - 导航到不同的 ViewController 时 BLE 外设断开连接

我正在开发具有多个ViewController的BLEiOS(Swift)应用程序。主ViewController有一个按钮,可导航到已检测到要连接的BLE设备的TableViewController。但是当我返回主视图或另一个View时,外围设备断开连接。我尝试将外围设备从TableViewController传递到主ViewController,但它仍然断开连接。主视图Controller:varbleManager:BLEManager!varperipheral:CBPeripheral!overridefuncviewDidLoad(){bleManager=BLEManag

安卓权限: Phone Calls: read phone state and identity

我的android应用与电话无关,但我看到当我在测试设备上安装调试版本时,它需要“电话:读取电话状态和身份”权限。(我在AndroidManifest.xml中没有提到这一点)。我想拥有尽可能少的权限,想知道是否有人知道如何摆脱它?我注释掉了我从Build.MODEL、Build.VERSION.*等记录一些东西的部分。我还注释掉了我检测景观的部分/portrait方向认为那可能是“电话状态”。但这些似乎都没有删除所需的权限。我发现了这个错误报告:http://code.google.com/p/android/issues/detail?id=4101但它被标记为按预期工作,并附有关