How to accurately get the device model name of iphone in compose multiplatform ?
Copy code
UIDevice.currentDevice.model - This just gives iPhone
UIDevice.currentDevice.name - This is not accurate because user will most likely modify the name.
not kotlin but kotlin colored 4
l
Ludovic
12/18/2024, 12:48 PM
This is not a Kotlin multiplatform nor a compose problem, hence the not kotlin but kotlin colored reactions.
This is a limitation on iOS
UIDevice
api.
I could recommend taking a look at libraires such as DeviceKit, but they rely on a call to
uname
to get an identifier from which they try to determine the actual device model.
Meaning: every time a new device comes out, you would have to update the library and publish a new version of the app if you don't want to end up in the unknown case.