Last active
October 31, 2022 06:05
-
-
Save acalism/91b2ccbd5edc1208dfad96bd9cac24de to your computer and use it in GitHub Desktop.
How to get Device Model and Model Name(Human readable)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// see my comments |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use private API
-[UIDevice _deviceInfoForKey:]
carefully, you won't be rejected by Apple,How did I get the key "marketing-name"?
Running on a simulator,
NSProcessInfo.processInfo.environment
contains a key named "SIMULATOR_CAPABILITIES", the value of which is a plist file. Then you open the plist file, you will get the model name's key "marketing-name".