0
I’m starting with Swift and I need to get the exact model of IPHONE of the client, already tried the Uidevice() but he only returns to me Iphone or Ipad and I need to know if the device is a SE, 7, 8+, X, etc. Someone knows how to do?
0
I’m starting with Swift and I need to get the exact model of IPHONE of the client, already tried the Uidevice() but he only returns to me Iphone or Ipad and I need to know if the device is a SE, 7, 8+, X, etc. Someone knows how to do?
1
Opa came to take a look at this answer? https://stackoverflow.com/questions/26028918/how-to-determine-the-current-iphone-device-model
This function seems to return what you need
func modelIdentifier() -> String {
if let simulatorModelIdentifier = ProcessInfo().environment["SIMULATOR_MODEL_IDENTIFIER"] { return simulatorModelIdentifier }
var sysinfo = utsname()
uname(&sysinfo) // ignore return value
return String(bytes: Data(bytes: &sysinfo.machine, count: Int(_SYS_NAMELEN)), encoding: .ascii)!.trimmingCharacters(in: .controlCharacters)
}
Browser other questions tagged swift swift-3
You are not signed in. Login or sign up in order to post.