问题描述
- swift 里 NSDATA 转 NSSTRING 报错 意外发现空
-
我的NSdata 里 打印出来是optional < ef010100 04001000 15>
我使用
data 是NSdata
let str:NSString = NSString(data:data,encoding:NSUTF8StringEncoding)
报错 意外发现空
NSdata里有空格
如果转 byte数组 请写一个例子学习
解决方案
先要看你的data是否为optional变量 这样转换就有可能为nil
解决方案二:
我的optional 是蓝牙回传值 应该怎么写才能不会空
时间: 2024-08-04 04:26:07