function hexToBytes(hexString) {
var result = [];
for (var i = 0; i < hexString.length; i += 2) {
result.push(parseInt(hexString.substring(i, i + 2), 16));
}
return new Uint8Array(result);
}
let NSData = plus.ios.importClass('NSData');
let NSFileHandle = plus.ios.importClass('NSFileHandle')
let NSFileManager = plus.ios.importClass('NSFileManager');
let data = '1a3f4b4105279cd80f8b38a2b674ee51'
let byteArray = hexToBytes(data)
var nsData = plus.ios.invoke('NSData', 'dataWithBytesNoCopy:length:', byteArray.buffer, byteArray.byteLength);
console.log(nsData)
// 检查 NSData 内容
let nsDataString = plus.ios.invoke(nsData, "description");
console.log(nsDataString)
最后nsData中的描述是{length = 16, bytes = 0x680d24e1010000000000000000000000}这样的
0 个回复