NativeScript / ios

NativeScript for iOS and visionOS using V8
https://docs.nativescript.org/guide/ios-marshalling
132 stars 33 forks source link

Readout of deviceId crashes runtime #124

Open cjohn001 opened 3 years ago

cjohn001 commented 3 years ago

Hello together, I have the following code snipped which I used to read out the deviceId. The last line now crashes the runtime. If someone know of a workaround, would be great to have it mentioned here. Thanks!

"@nativescript/ios": "version": "8.1.0-rc.1",

const systemInfo = new interop.Reference(); uname(systemInfo); deviceId = NSString.stringWithUTF8String(systemInfo.value.machine).toString();

cjohn001 commented 3 years ago

Ok, this here works as a workaround:

const _SYS_NAMELEN = 256; const buffer = interop.alloc(5 _SYS_NAMELEN); uname(buffer); deviceId = NSString.stringWithUTF8String(buffer.add(_SYS_NAMELEN 4)).toString();