Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Readout of deviceId crashes runtime #124

Open
cjohn001 opened this issue Aug 15, 2021 · 1 comment
Open

Readout of deviceId crashes runtime #124

cjohn001 opened this issue Aug 15, 2021 · 1 comment

Comments

@cjohn001
Copy link

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
Copy link
Author

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();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant