NativeScript / plugins

@nativescript plugins to help with your developments.
https://docs.nativescript.org/plugins/index.html
Apache License 2.0
190 stars 107 forks source link

[@nativescript-haptics] ReferenceError: uname is not defined when using iOS 8.8.x #596

Closed sublime392 closed 1 month ago

sublime392 commented 1 month ago

ReferenceError: uname is not defined at deviceInfo (file: src/webpack:/nativescript-ib/node_modules/@nativescript/haptics/index.ios.js:87:0)

This does not happen when using iOS 8.7.1

NathanWalker commented 1 month ago

Thank you for tracking! We can remove uname usage from haptics.

cjohn001 commented 1 month ago

Hello together, I just ran into the same issue not being able to use uname anymore. I cannot simply remove its usage as I need to read the machine information. Can the uname function not be used in NS anymore or do I need to include it in a different way now? Thanks for your directions!

const _SYS_NAMELEN = 256;
const buffer = interop.alloc(5 * _SYS_NAMELEN);
uname(buffer);
const utsname = new Utsname();
utsname.sysname = NSString.stringWithUTF8String(buffer.add(_SYS_NAMELEN * 0)).toString(); // sysname
utsname.nodename = NSString.stringWithUTF8String(buffer.add(_SYS_NAMELEN * 1)).toString(); // nodename
utsname.release = NSString.stringWithUTF8String(buffer.add(_SYS_NAMELEN * 2)).toString(); // release
utsname.version = NSString.stringWithUTF8String(buffer.add(_SYS_NAMELEN * 3)).toString(); // version
utsname.machine = NSString.stringWithUTF8String(buffer.add(_SYS_NAMELEN * 4)).toString(); // machine
deviceId = utsname.machine;
NathanWalker commented 1 month ago

Fixed in 3.1.0

correct @cjohn001 we don't use uname any longer.

cjohn001 commented 1 month ago

@NathanWalker: Thanks for the info. I suspected it. Fortunately, I found a way to do things without uname. I previously used it to detect, if the app is running on a simulator.