나는 Adafruit Basic-Chat을 참고 자료로 사용하고 있습니다.Swift-BLE-UART 다양한보기 컨트롤러 장면에서 읽고 쓰는 방법은 무엇입니까?
https://github.com/adafruit/Basic-Chat/tree/master/Basic%20Chat
나는 기본적인 UART 통신을위한 내 사용자 정의 내장 노르딕 BLE-모듈과 통신하는 코드를 정의했다. 쓰기 10 바이트 및 읽을 10 바이트. 나는 UartModuleViewController에서 읽고 쓸 수 있지만 곧 새로운 View Controller를 만들고 같은 peripheral.writeValue를 사용하려고하면 두 번째 ViewController의 peripheral.writeValue 줄에 오류가 발생합니다. 다른 사람이 도와 주실 수 있습니까? 비슷한 뷰어 컨트롤러 장면에 연결된 동일한 주변 장치를 전달하는 방법으로 비슷하게 쓰기/읽기 기능을 사용할 수 있습니까?
//This is my write code
let bytes : [UInt8] = [ 0x1A, 0x2B, 0x3C, 0x4D ]
let Transmitdata = NSData(bytes: bytes, length: bytes.count)
peripheral.writeValue(Transmitdata as Data, for: txCharacteristic!, type: CBCharacteristicWriteType.withoutResponse)
print("Data Sent",Transmitdata)
//이 내 읽기 코드 내가 읽고 내 모든 뷰 컨트롤러를 통해 작성이 동일한 두 블록을 사용할
let ReceiveData = rxCharacteristic?.value
if let ReceiveData = ReceiveData {
let ReceivedNoOfBytes = ReceiveData.count
var ReceivedByteArray = [UInt8](repeating: 0, count: ReceivedNoOfBytes)
(ReceiveData as NSData).getBytes(&ReceivedByteArray, length: ReceivedNoOfBytes)
print("Data Received ",ReceivedByteArray)
입니까? (나는 모든 클래스에서 같은 블록을 사용하고자하는 10 개의 뷰 컨트롤러를 가지고있다.) 나는 스위프트/iOS의 초보자이며 제한된 정보 만이 참조 할 수 있도록되어있어, 이것이 나 같은 초보자에게 도움이되기를 희망한다. 도와주세요. 감사 NAR
0x1000d9b78 <+2408>: uxtb w2, w9
0x1000d9b7c <+2412>: uxtb w5, w9
0x1000d9b80 <+2416>: mov x6, x10
0x1000d9b84 <+2420>: bl 0x1000e0174 ; symbol stub for: function signature specialization <preserving fragile attribute, Arg[2] = Dead, Arg[3] = Dead> of Swift._fatalErrorMessage(Swift.StaticString, Swift.StaticString, file: Swift.StaticString, line: Swift.UInt, flags: Swift.UInt32) -> Swift.Never
0x1000d9b88 <+2424>: ldr x8, [x19, #0xab8]. <- This is where it throws an error/exception/fatal error.
스레드 1 : EXC_BREAKPOINT (코드 = 1, 서브 코드 = 0x10042b200는)