├── msbuild ├── Icons └── GetiOSModel.png ├── packages.config ├── iOSChipType.cs ├── Properties └── AssemblyInfo.cs ├── GetiOSModel.sln ├── LICENSE ├── LICENSE.txt ├── README.md ├── Xamarin.iOS.DeviceHardware.cs ├── .gitignore ├── GetiOSModel.csproj ├── iOSChipTypeMap.cs └── iOSHardware.cs /msbuild: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Icons/GetiOSModel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dannycabrera/Get-iOS-Model/HEAD/Icons/GetiOSModel.png -------------------------------------------------------------------------------- /packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /iOSChipType.cs: -------------------------------------------------------------------------------- 1 | namespace Xamarin.iOS 2 | { 3 | public enum iOSChipType 4 | { 5 | Unknown, 6 | A4, 7 | A5, 8 | A5X, 9 | A6, 10 | A6X, 11 | A7, 12 | A8, 13 | A8X, 14 | A9, 15 | A9X, 16 | A10Fusion, 17 | A10XFusion, 18 | A11Bionic, 19 | A12Bionic, 20 | A12XBionic, 21 | A12ZBionic, 22 | A13Bionic, 23 | A14Bionic, 24 | A15Bionic, 25 | AppleSiliconMac, 26 | M1 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // Information about this assembly is defined by the following attributes. 5 | // Change them to the values specific to your project. 6 | 7 | [assembly: AssemblyTitle("GetiOSModel")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("")] 12 | [assembly: AssemblyCopyright("")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 19 | 20 | [assembly: AssemblyVersion("1.4")] 21 | 22 | // The following attributes are used to specify the signing key for the assembly, 23 | // if desired. See the Mono documentation for more information about signing. 24 | 25 | //[assembly: AssemblyDelaySign(false)] 26 | //[assembly: AssemblyKeyFile("")] 27 | -------------------------------------------------------------------------------- /GetiOSModel.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GetiOSModel", "GetiOSModel.csproj", "{B5226EB0-0E82-432C-84F2-2216F4AC466E}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Any CPU = Debug|Any CPU 9 | Release|Any CPU = Release|Any CPU 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {B5226EB0-0E82-432C-84F2-2216F4AC466E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 13 | {B5226EB0-0E82-432C-84F2-2216F4AC466E}.Debug|Any CPU.Build.0 = Debug|Any CPU 14 | {B5226EB0-0E82-432C-84F2-2216F4AC466E}.Release|Any CPU.ActiveCfg = Release|Any CPU 15 | {B5226EB0-0E82-432C-84F2-2216F4AC466E}.Release|Any CPU.Build.0 = Release|Any CPU 16 | EndGlobalSection 17 | GlobalSection(MonoDevelopProperties) = preSolution 18 | version = 1.17 19 | Policies = $0 20 | $0.DotNetNamingPolicy = $1 21 | $1.DirectoryNamespaceAssociation = PrefixedHierarchical 22 | EndGlobalSection 23 | EndGlobal 24 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2019 Danny Cabrera 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2019 Danny Cabrera 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![GetiOSModel Logo](https://github.com/dannycabrera/Get-iOS-Model/raw/master/Icons/GetiOSModel.png) 2 | 3 | Get-iOS-Model 4 | ============= 5 | 6 | Get the iOS model using the hw.machine string 7 | 8 | | Package | 9 | |:----------| 10 | |[![NuGet Badge GetiOSModel](https://buildstats.info/nuget/dannycabrera.GetiOSModel)](https://www.nuget.org/packages/dannycabrera.GetiOSModel)| 11 | 12 | ******* 13 | Will keep repository updated as new devices become available. 14 | 15 | Updates:
16 | 20211001 - Added new iPhone 13 models and updated 2021 iPad models
17 | 20210529 - Added new iPad models: iPad Pro (11-inch) (3rd generation) and iPad Pro (12.9-inch) (5th generation), corrected/added missing from iPad11,6 to iPad13,2's chip name.
18 | 20201212 - Added latest iPad and iPhone models
19 | 20200404 - Added iPhone SE (2nd generation)
20 | 20200327 - Added new iPad models iPad Pro 11-inch (2nd generation) and iPad Pro 12.9-inch (4th generation)
21 | 20190919 - Added hardware strings and chip types for new iPhone 11 models and iPad (7th generation) models
22 | 20190905 - Added Apple Chip Type property
23 | 20190601 - Added iPod touch 7th generation
24 | 20190327 - Added 2019 iPad models: iPad mini 5 and iPad Air 3
25 | 20181107 - iPad Pro 11-inch whitespace character fix thanks to @adamzucchi
26 | 20181106 - Added new iPad models: iPad Pro 12.9-inch (3rd generation) and iPad Pro 11-inch
27 | 20180921 - Added new iPhone models: iPhone XR, iPhone Xs and iPhone Xs Max
28 | 20180330 - Added Apple Tech specs link for iPad 6th generation
29 | 20180328 - Added new iPad 6th generation (2018 9.7-inch model)
30 | 20170929 - Model info now returned on simulators & updated Nuget to v1.3.
31 | 20170919 - Added iPhone 8, 8 Plus and X. Also updating NuGet to v1.2.
32 | 20170914 - NuGet updated to v1.1
33 | 20170706 - Adding NuGet
34 | 20170627 - Added iPad Pro (12.9-inch 2nd generation) and iPad Pro (10.5-inch)
35 | 20170321 - Added new iPad 5th generation
36 | 20161026 - corrected/added missing iPad6,4
37 | 20160912 - added iPhone 7 and 7 Plus
38 | 20160330 - added iPad Pro (9.7-inch) and iPhone SE
39 | 20160119 - added iPad Pro
40 | 20150928 - added iPhone 6s & iPhone 6s Plus
41 | 20150715 - added iPod 6th Generation
42 | 20141020 - added iPad Air 2 & iPad mini 3
43 | 20140917 - added iPhone 6 and 6 Plus
44 | 20140108 - added iPad Mini Retina and iPad Air
45 | ******* 46 | 47 | ## Install 48 | 49 | #### [NuGet Gallery](https://www.nuget.org/packages/dannycabrera.GetiOSModel) 50 | ``` 51 | Install-Package dannycabrera.GetiOSModel 52 | ``` 53 | 54 | Sample 55 | ------- 56 | 57 | ``` 58 | Console.WriteLine(Xamarin.iOS.DeviceHardware.Version); 59 | ``` 60 | 61 | Result: "iPhone5,3" 62 | 63 | 64 | ``` 65 | Console.WriteLine(Xamarin.iOS.DeviceHardware.Model); 66 | ``` 67 | 68 | Result: "iPhone 5C GSM" 69 | 70 | ``` 71 | Console.WriteLine(Xamarin.iOS.DeviceHardware.ChipType); 72 | ``` 73 | 74 | Result: "A6" 75 | 76 | ******* 77 | Thanks to: 78 | ------- 79 | @sven-s, @manishkungwani, @jimbobbennett, @adamzucchi, @follesoe and @CoreNion for their pull requests. 80 | -------------------------------------------------------------------------------- /Xamarin.iOS.DeviceHardware.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using Foundation; 4 | using ObjCRuntime; 5 | 6 | namespace Xamarin.iOS 7 | { 8 | [Preserve(AllMembers = true)] 9 | public static class DeviceHardware 10 | { 11 | private const string HardwareProperty = "hw.machine"; 12 | 13 | [DllImport(Constants.SystemLibrary)] 14 | private static extern int sysctlbyname([MarshalAs(UnmanagedType.LPStr)] string property, 15 | IntPtr output, 16 | IntPtr oldLen, 17 | IntPtr newp, 18 | uint newlen); 19 | 20 | private static readonly iOSHardware _hardwareMapper = new iOSHardware(); 21 | private static readonly Lazy _version = new Lazy(FindVersion); 22 | 23 | private static string FindVersion() 24 | { 25 | try 26 | { 27 | // get the length of the string that will be returned 28 | var pLen = Marshal.AllocHGlobal(sizeof(int)); 29 | sysctlbyname(HardwareProperty, IntPtr.Zero, pLen, IntPtr.Zero, 0); 30 | 31 | var length = Marshal.ReadInt32(pLen); 32 | 33 | // check to see if we got a length 34 | if (length == 0) 35 | { 36 | Marshal.FreeHGlobal(pLen); 37 | return "Unknown"; 38 | } 39 | 40 | // get the hardware string 41 | var pStr = Marshal.AllocHGlobal(length); 42 | sysctlbyname(HardwareProperty, pStr, pLen, IntPtr.Zero, 0); 43 | 44 | // convert the native string into a C# string 45 | var hardwareStr = Marshal.PtrToStringAnsi(pStr); 46 | 47 | // cleanup 48 | Marshal.FreeHGlobal(pLen); 49 | Marshal.FreeHGlobal(pStr); 50 | 51 | return hardwareStr; 52 | } 53 | catch (Exception ex) 54 | { 55 | Console.WriteLine("DeviceHardware.Version Ex: " + ex.Message); 56 | } 57 | 58 | return "Unknown"; 59 | } 60 | 61 | public static string Version => IsiOSAppOnMac() ? "mac" : FindVersion(); 62 | 63 | public static iOSChipType ChipType 64 | { 65 | get 66 | { 67 | var v = Version; 68 | if (IsSimulator(v)) 69 | { 70 | return _hardwareMapper.GetChipType(SimulatorModel); 71 | } 72 | return _hardwareMapper.GetChipType(v); 73 | } 74 | } 75 | 76 | public static string Model 77 | { 78 | get 79 | { 80 | var v = Version; 81 | if (IsSimulator(v)) 82 | { 83 | return _hardwareMapper.GetModel(SimulatorModel) + " Simulator"; 84 | } 85 | return _hardwareMapper.GetModel(v); 86 | } 87 | } 88 | 89 | private static bool IsiOSAppOnMac() => 90 | UIKit.UIDevice.CurrentDevice.CheckSystemVersion(14, 0) && NSProcessInfo.ProcessInfo.IsiOSApplicationOnMac; 91 | 92 | private static bool IsSimulator(string v) => v == "i386" || v == "x86_64"; 93 | 94 | private static string SimulatorModel => NSProcessInfo.ProcessInfo.Environment["SIMULATOR_MODEL_IDENTIFIER"].ToString(); 95 | } 96 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------------------ 2 | # 3 | # Microsoft Visual Studio - https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 4 | 5 | ## Ignore Visual Studio temporary files, build results, and 6 | ## files generated by popular Visual Studio add-ons. 7 | # User-specific files 8 | *.suo 9 | *.user 10 | *.userprefs 11 | *.sln.docstates 12 | .vs/ 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | build/ 21 | bld/ 22 | [Bb]in/ 23 | [Oo]bj/ 24 | # Roslyn cache directories 25 | *.ide/ 26 | # MSTest test Results 27 | [Tt]est[Rr]esult*/ 28 | [Bb]uild[Ll]og.* 29 | #NUNIT 30 | *.VisualState.xml 31 | TestResult.xml 32 | TestResult*.xml 33 | TestResult*.txt 34 | # Build Results of an ATL Project 35 | [Dd]ebugPS/ 36 | [Rr]eleasePS/ 37 | dlldata.c 38 | *_i.c 39 | *_p.c 40 | *_i.h 41 | *.ilk 42 | *.meta 43 | *.obj 44 | *.pch 45 | *.pdb 46 | *.pgc 47 | *.pgd 48 | *.rsp 49 | *.sbr 50 | *.tlb 51 | *.tli 52 | *.tlh 53 | *.tmp 54 | *.tmp_proj 55 | *.log 56 | *.vspscc 57 | *.vssscc 58 | .builds 59 | *.pidb 60 | *.svclog 61 | *.scc 62 | # Chutzpah Test files 63 | _Chutzpah* 64 | # Visual C++ cache files 65 | ipch/ 66 | *.aps 67 | *.ncb 68 | *.opensdf 69 | *.sdf 70 | *.cachefile 71 | # Visual Studio profiler 72 | *.psess 73 | *.vsp 74 | *.vspx 75 | # TFS 2012 Local Workspace 76 | $tf/ 77 | # Guidance Automation Toolkit 78 | *.gpState 79 | # ReSharper is a .NET coding add-in 80 | _ReSharper*/ 81 | *.[Rr]e[Ss]harper 82 | *.DotSettings.user 83 | # JustCode is a .NET coding addin-in 84 | .JustCode 85 | # TeamCity is a build add-in 86 | _TeamCity* 87 | # DotCover is a Code Coverage Tool 88 | *.dotCover 89 | # NCrunch 90 | _NCrunch_* 91 | .*crunch*.local.xml 92 | # MightyMoose 93 | *.mm.* 94 | AutoTest.Net/ 95 | # Web workbench (sass) 96 | .sass-cache/ 97 | # Installshield output folder 98 | [Ee]xpress/ 99 | # DocProject is a documentation generator add-in 100 | DocProject/buildhelp/ 101 | DocProject/Help/*.HxT 102 | DocProject/Help/*.HxC 103 | DocProject/Help/*.hhc 104 | DocProject/Help/*.hhk 105 | DocProject/Help/*.hhp 106 | DocProject/Help/Html2 107 | DocProject/Help/html 108 | # Click-Once directory 109 | publish/ 110 | # Publish Web Output 111 | *.[Pp]ublish.xml 112 | *.azurePubxml 113 | # TODO: Comment the next line if you want to checkin your web deploy settings 114 | # but database connection strings (with potential passwords) will be unencrypted 115 | *.pubxml 116 | *.publishproj 117 | # NuGet Packages 118 | *.nupkg 119 | # The packages folder can be ignored because of Package Restore 120 | **/packages/* 121 | # except build/, which is used as an MSBuild target. 122 | !**/packages/build/ 123 | # If using the old MSBuild-Integrated Package Restore, uncomment this: 124 | #!**/packages/repositories.config 125 | # Windows Azure Build Output 126 | csx/ 127 | *.build.csdef 128 | # Windows Store app package directory 129 | AppPackages/ 130 | # Others 131 | sql/ 132 | *.Cache 133 | ClientBin/ 134 | [Ss]tyle[Cc]op.* 135 | ~$* 136 | *~ 137 | *.dbmdl 138 | *.dbproj.schemaview 139 | *.pfx 140 | *.publishsettings 141 | node_modules/ 142 | # RIA/Silverlight projects 143 | Generated_Code/ 144 | # Backup & report files from converting an old project file 145 | # to a newer Visual Studio version. Backup files are not needed, 146 | # because we have git ;-) 147 | _UpgradeReport_Files/ 148 | Backup*/ 149 | UpgradeLog*.XML 150 | UpgradeLog*.htm 151 | # SQL Server files 152 | *.mdf 153 | *.ldf 154 | # Business Intelligence projects 155 | *.rdl.data 156 | *.bim.layout 157 | *.bim_*.settings 158 | # Microsoft Fakes 159 | FakesAssemblies/ 160 | # EROAD driver app specific ignore directives 161 | **/bin/ 162 | **/obj/ 163 | #Xamarin Studio 164 | *.userprefs 165 | #Mac files 166 | *.DS_Store 167 | **/Thumbs.db 168 | 169 | # ignore Xamarin.Android Resource.Designer.cs files 170 | **/[Rr]esource.[Dd]esigner.cs 171 | /.vs/config 172 | 173 | **/.fake/**/*.* 174 | **/.nuget/https:/**/*.* 175 | 176 | !Tools/NUnit 2.6.4/bin/* 177 | **/.droidres/.*.droidres.db 178 | 179 | *.orig 180 | 181 | # Paket 182 | .paket/paket.exe 183 | 184 | *.bak 185 | 186 | *.xcuserstate 187 | 188 | *.bak 189 | -------------------------------------------------------------------------------- /GetiOSModel.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {B5226EB0-0E82-432C-84F2-2216F4AC466E} 8 | {FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 9 | Library 10 | GetiOSModel 11 | GetiOSModel 12 | Resources 13 | true 14 | dannycabrera.GetiOSModel 15 | 1.17 16 | Danny Cabrera, Jim Bennett 17 | https://github.com/dannycabrera/Get-iOS-Model 18 | A Xamarin library to get the current iOS device details 19 | Xamarin, iOS, Device, Hardware 20 | Get iOS device model and chip type details for Xamarin iOS 21 | Xamarin Helper library to get the name and chip type of the current iOS device. 22 | Added latest iPhone and iPad models 23 | 1.17 24 | https://github.com/dannycabrera/Get-iOS-Model/raw/master/Icons/GetiOSModel.png 25 | Danny Cabrera 26 | LICENSE.txt 27 | true 28 | 29 | 30 | true 31 | full 32 | false 33 | bin\Debug 34 | DEBUG; 35 | prompt 36 | 4 37 | iPhone Developer 38 | true 39 | true 40 | true 41 | true 42 | 26861 43 | true 44 | SdkOnly 45 | 46 | 47 | none 48 | true 49 | bin\Release 50 | prompt 51 | 4 52 | iPhone Developer 53 | true 54 | SdkOnly 55 | true 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /iOSChipTypeMap.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Foundation; 3 | 4 | namespace Xamarin.iOS 5 | { 6 | [Preserve(AllMembers = true)] 7 | internal class iOSChipTypeMap : Dictionary 8 | { 9 | private readonly Dictionary modelChipMap; 10 | 11 | public iOSChipTypeMap() 12 | { 13 | modelChipMap = new Dictionary 14 | { 15 | { "iPhone1,1", iOSChipType.A4 }, // iPhone 16 | { "iPhone1,2", iOSChipType.A4 }, // iPhone 3G 17 | { "iPhone2,1", iOSChipType.A4 }, // iPhone 3GS 18 | { "iPhone3,1", iOSChipType.A4 }, // iPhone 4 GSM 19 | { "iPhone3,2", iOSChipType.A4 }, // iPhone 4 GSM 20 | { "iPhone3,3", iOSChipType.A4 }, // iPhone 4 CDMA 21 | { "iPhone4,1", iOSChipType.A5 }, // iPhone 4S 22 | { "iPhone5,1", iOSChipType.A6 }, // iPhone 5 GSM 23 | { "iPhone5,2", iOSChipType.A6 }, // iPhone 5 Global 24 | { "iPhone5,3", iOSChipType.A6 }, // iPhone 5C GSM 25 | { "iPhone5,4", iOSChipType.A6 }, // iPhone 5C Global, 26 | { "iPhone6,1", iOSChipType.A7 }, // iPhone 5S GSM 27 | { "iPhone6,2", iOSChipType.A7 }, // iPhone 5S Global 28 | { "iPhone7,1", iOSChipType.A8 }, // iPhone 6 Plus 29 | { "iPhone7,2", iOSChipType.A8 }, // iPhone 6 30 | { "iPhone8,1", iOSChipType.A9 }, // iPhone 6S, 31 | { "iPhone8,2", iOSChipType.A9 }, // iPhone 6S Plus, 32 | { "iPhone8,4", iOSChipType.A9 }, // iPhone SE, 33 | { "iPhone12,8", iOSChipType.A13Bionic }, // iPhone SE (2nd), 34 | { "iPhone9,1", iOSChipType.A10Fusion }, // iPhone 7 35 | { "iPhone9,2", iOSChipType.A10Fusion }, // iPhone 7 Plus 36 | { "iPhone9,3", iOSChipType.A10Fusion }, // iPhone 7 37 | { "iPhone9,4", iOSChipType.A10Fusion }, // iPhone 7 Plus 38 | { "iPhone10,1", iOSChipType.A11Bionic }, // iPhone 8 39 | { "iPhone10,2", iOSChipType.A11Bionic }, // iPhone 8 Plus 40 | { "iPhone10,3", iOSChipType.A11Bionic }, // iPhone X 41 | { "iPhone10,4", iOSChipType.A11Bionic }, // iPhone 8 42 | { "iPhone10,5", iOSChipType.A11Bionic }, // iPhone 8 Plus 43 | { "iPhone10,6", iOSChipType.A11Bionic }, // iPhone X 44 | { "iPhone11,2", iOSChipType.A12Bionic }, // iPhone XS 45 | { "iPhone11,4", iOSChipType.A12Bionic }, // iPhone XS Max 46 | { "iPhone11,6", iOSChipType.A12Bionic }, // iPhone XS Max 47 | { "iPhone11,8", iOSChipType.A12Bionic }, // iPhone XR 48 | { "iPhone12,1", iOSChipType.A13Bionic }, // iPhone 11 49 | { "iPhone12,3", iOSChipType.A13Bionic }, // iPhone 11 Pro 50 | { "iPhone12,5", iOSChipType.A13Bionic }, // iPhone 11 Pro Max 51 | { "iPhone13,1", iOSChipType.A14Bionic }, // iPhone 12 mini 52 | { "iPhone13,2", iOSChipType.A14Bionic }, // iPhone 12 53 | { "iPhone13,3", iOSChipType.A14Bionic }, // iPhone 12 Pro 54 | { "iPhone13,4", iOSChipType.A14Bionic }, // iPhone 12 Pro Max 55 | { "iPhone14,2", iOSChipType.A15Bionic }, // iPhone 13 Pro 56 | { "iPhone14,3", iOSChipType.A15Bionic }, // iPhone 13 Pro Max 57 | { "iPhone14,4", iOSChipType.A15Bionic }, // iPhone 13 mini 58 | { "iPhone14,5", iOSChipType.A15Bionic }, // iPhone 13 59 | { "iPad1,1", iOSChipType.A4 }, // iPad 60 | { "iPad2,1", iOSChipType.A5 }, // iPad 2 Wi-Fi 61 | { "iPad2,2", iOSChipType.A5 }, // iPad 2 GSM 62 | { "iPad2,3", iOSChipType.A5 }, // iPad 2 CDMA 63 | { "iPad2,4", iOSChipType.A5 }, // iPad 2 Wi-Fi 64 | { "iPad2,5", iOSChipType.A5 }, // iPad mini Wi-Fi 65 | { "iPad2,6", iOSChipType.A5 }, // iPad mini Wi-Fi + Cellular 66 | { "iPad2,7", iOSChipType.A5 }, // iPad mini Wi-Fi + Cellular (MM) 67 | { "iPad3,1", iOSChipType.A5 }, // iPad 3 Wi-Fi 68 | { "iPad3,2", iOSChipType.A5 }, // iPad 3 Wi-Fi + Cellular (VZ) 69 | { "iPad3,3", iOSChipType.A5X }, // iPad 3 Wi-Fi + Cellular 70 | { "iPad3,4", iOSChipType.A6X }, // iPad 4 Wi-Fi 71 | { "iPad3,5", iOSChipType.A6X }, // iPad 4 Wi-Fi + Cellular 72 | { "iPad3,6", iOSChipType.A6X }, // iPad 4 Wi-Fi + Cellular (MM) 73 | { "iPad4,1", iOSChipType.A7 }, // iPad Air Wi-Fi 74 | { "iPad4,2", iOSChipType.A7 }, // iPad Air Wi-Fi + Cellular 75 | { "iPad4,3", iOSChipType.A7 }, // iPad Air Wi-Fi + Cellular (TD-LTE) 76 | { "iPad4,4", iOSChipType.A7 }, // iPad mini 2 Wi-Fi 77 | { "iPad4,5", iOSChipType.A7 }, // iPad mini 2 Wi-Fi + Cellular 78 | { "iPad4,6", iOSChipType.A7 }, // iPad mini 2 Wi-Fi + Cellular (TD-LTE) 79 | { "iPad4,7", iOSChipType.A7 }, // iPad mini 3 Wi-Fi 80 | { "iPad4,8", iOSChipType.A7 }, // iPad mini 3 Wi-Fi + Cellular 81 | { "iPad4,9", iOSChipType.A7 }, // iPad mini 3 Wi-Fi + Cellular (TD-LTE) 82 | { "iPad5,1", iOSChipType.A8 }, // iPad mini 4 Wi-Fi 83 | { "iPad5,2", iOSChipType.A8 }, // iPad mini 4 Wi-Fi + Cellular 84 | { "iPad5,3", iOSChipType.A8X }, // iPad Air 2 Wi-Fi 85 | { "iPad5,4", iOSChipType.A8X }, // iPad Air 2 Wi-Fi + Cellular 86 | { "iPad6,3", iOSChipType.A9X }, // iPad Pro 9.7" Wi-Fi 87 | { "iPad6,4", iOSChipType.A9X }, // iPad Pro 9.7" Wi-Fi + Cellular 88 | { "iPad6,7", iOSChipType.A9X }, // iPad Pro 12.9" Wi-Fi 89 | { "iPad6,8", iOSChipType.A9X }, // iPad Pro 12.9" Wi-Fi + Cellular 90 | { "iPad6,11", iOSChipType.A9 }, // iPad 5th gen Wi-Fi 91 | { "iPad6,12", iOSChipType.A9 }, // iPad 5th gen Wi-Fi + Cellular 92 | { "iPad7,1", iOSChipType.A10XFusion }, // iPad Pro 12.9" 2nd gen Wi-Fi 93 | { "iPad7,2", iOSChipType.A10XFusion }, // iPad Pro 12.9" 2nd gen Wi-Fi + Cellular 94 | { "iPad7,3", iOSChipType.A10XFusion }, // iPad Pro 10.5" Wi-Fi 95 | { "iPad7,4", iOSChipType.A10XFusion }, // iPad Pro 10.5" Wi-Fi + Cellular 96 | { "iPad7,5", iOSChipType.A10Fusion }, // iPad 9.7" 6th gen Wi-Fi 97 | { "iPad7,6", iOSChipType.A10Fusion }, // iPad 9.7" 6th gen Wi-Fi + Cellular 98 | { "iPad7,11", iOSChipType.A10Fusion }, // iPad 10.2" 7th gen Wi-Fi 99 | { "iPad7,12", iOSChipType.A10Fusion }, // iPad 10.2" 7th gen Wi-Fi + Cellular 100 | { "iPad8,1", iOSChipType.A12XBionic }, // iPad Pro 11" Wi-Fi 101 | { "iPad8,2", iOSChipType.A12XBionic }, // iPad Pro 11" Wi-Fi 102 | { "iPad8,3", iOSChipType.A12XBionic }, // iPad Pro 11" Wi-Fi + Cellular 103 | { "iPad8,4", iOSChipType.A12XBionic }, // iPad Pro 11" Wi-Fi + Cellular 104 | { "iPad8,9", iOSChipType.A12ZBionic }, // iPad Pro 11-inch (2nd generation) Wi-Fi 105 | { "iPad8,10", iOSChipType.A12ZBionic }, // iPad Pro 11-inch (2nd generation) Wi-Fi + Cellular 106 | { "iPad8,5", iOSChipType.A12XBionic }, // iPad Pro 12.9" 3nd gen Wi-Fi 107 | { "iPad8,6", iOSChipType.A12XBionic }, // iPad Pro 12.9" 3nd gen Wi-Fi 108 | { "iPad8,7", iOSChipType.A12XBionic }, // iPad Pro 12.9" 3nd gen Wi-Fi + Cellular 109 | { "iPad8,8", iOSChipType.A12XBionic }, // iPad Pro 12.9" 3nd gen Wi-Fi + Cellular 110 | { "iPad8,11", iOSChipType.A12ZBionic }, // iPad Pro 12.9" 4th gen Wi-Fi 111 | { "iPad8,12", iOSChipType.A12ZBionic }, // iPad Pro 12.9" 4th gen Wi-Fi + Cellular 112 | { "iPad11,1", iOSChipType.A12Bionic }, // iPad mini 5 Wi-Fi 113 | { "iPad11,2", iOSChipType.A12Bionic }, // iPad mini 5 Wi-Fi + Cellular 114 | { "iPad11,3", iOSChipType.A12Bionic }, // iPad Air 3rd gen Wi-Fi 115 | { "iPad11,4", iOSChipType.A12Bionic }, // iPad Air 3rd gen Wi-Fi + Cellular 116 | { "iPad11,6", iOSChipType.A12Bionic }, // iPad (8th Generation) Wi-Fi 117 | { "iPad11,7", iOSChipType.A12Bionic }, // iPad (8th Generation) Wi-Fi + Cellular 118 | { "iPad12,1", iOSChipType.A13Bionic }, // iPad (9th Generation) Wi-Fi 119 | { "iPad12,2", iOSChipType.A13Bionic }, // iPad (9th Generation) Wi-Fi + Cellular 120 | { "iPad13,1", iOSChipType.A14Bionic }, // iPad Air (4th generation) Wi-Fi 121 | { "iPad13,2", iOSChipType.A14Bionic }, // iPad Air (4th generation) Wi-Fi + Cellular 122 | { "iPad13,4", iOSChipType.M1 }, // iPad Pro (11-inch) (3rd generation) Wi-Fi 123 | { "iPad13,5", iOSChipType.M1 }, // iPad Pro (11-inch) (3rd generation) Wi-Fi 124 | { "iPad13,6", iOSChipType.M1 }, // iPad Pro (11-inch) (3rd generation) Wi-Fi + Cellular 125 | { "iPad13,7", iOSChipType.M1 }, // iPad Pro (11-inch) (3rd generation) Wi-Fi + Cellular 126 | { "iPad13,8", iOSChipType.M1 }, // iPad Pro (12.9-inch) (5th generation) Wi-Fi 127 | { "iPad13,9", iOSChipType.M1 }, // iPad Pro (12.9-inch) (5th generation) Wi-Fi 128 | { "iPad13,10", iOSChipType.M1 }, // iPad Pro (12.9-inch) (5th generation) Wi-Fi + Cellular 129 | { "iPad13,11", iOSChipType.M1 }, // iPad Pro (12.9-inch) (5th generation) Wi-Fi + Cellular 130 | { "iPad14,1", iOSChipType.A15Bionic }, // iPad mini 5 Wi-Fi 131 | { "iPad14,2", iOSChipType.A15Bionic }, // iPad mini 5 Wi-Fi + Cellular 132 | { "iPod1,1", iOSChipType.A4 }, // iPod Touch 133 | { "iPod2,1", iOSChipType.A4 }, // iPod Touch 2st gen 134 | { "iPod3,1", iOSChipType.A4 }, // iPod Touch 3rd gen 135 | { "iPod4,1", iOSChipType.A4 }, // iPod Touch 4th gen 136 | { "iPod5,1", iOSChipType.A5 }, // iPod Touch 5th gen 137 | { "iPod7,1", iOSChipType.A8 }, // iPod Touch 6th gen 138 | { "iPod9,1", iOSChipType.A10Fusion }, // iPod Touch 7th gen 139 | { "mac", iOSChipType.AppleSiliconMac }, // iOS app running on Apple Silicon Mac 140 | }; 141 | } 142 | 143 | public iOSChipType GetChipType(string hardware) => modelChipMap.ContainsKey(hardware) ? modelChipMap[hardware] : iOSChipType.Unknown; 144 | } 145 | } 146 | -------------------------------------------------------------------------------- /iOSHardware.cs: -------------------------------------------------------------------------------- 1 | using Foundation; 2 | 3 | namespace Xamarin.iOS 4 | { 5 | [Preserve(AllMembers = true)] 6 | class iOSHardware 7 | { 8 | private readonly iOSChipTypeMap _chipTypeMap; 9 | 10 | public iOSHardware() 11 | { 12 | _chipTypeMap = new iOSChipTypeMap(); 13 | } 14 | 15 | public iOSChipType GetChipType(string hardware) => _chipTypeMap.GetChipType(hardware); 16 | 17 | public string GetModel(string hardware) 18 | { 19 | if (hardware.StartsWith("iPhone")) 20 | { 21 | switch (hardware) 22 | { 23 | case "iPhone14,2": 24 | return "iPhone 13 Pro"; 25 | case "iPhone14,3": 26 | return "iPhone 13 Pro Max"; 27 | case "iPhone14,4": 28 | return "iPhone 13 mini"; 29 | case "iPhone14,5": 30 | return "iPhone 13"; 31 | case "iPhone13,1": 32 | return "iPhone 12 mini"; 33 | case "iPhone13,2": 34 | return "iPhone 12"; 35 | case "iPhone13,3": 36 | return "iPhone 12 Pro"; 37 | case "iPhone13,4": 38 | return "iPhone 12 Pro Max"; 39 | case "iPhone12,8": 40 | return "iPhone SE (2nd generation)"; 41 | case "iPhone12,5": 42 | return "iPhone 11 Pro Max"; 43 | case "iPhone12,3": 44 | return "iPhone 11 Pro"; 45 | case "iPhone12,1": 46 | return "iPhone 11"; 47 | case "iPhone11,2": 48 | return "iPhone XS"; 49 | case "iPhone11,4": 50 | case "iPhone11,6": 51 | return "iPhone XS Max"; 52 | case "iPhone11,8": 53 | return "iPhone XR"; 54 | case "iPhone10,3": 55 | case "iPhone10,6": 56 | return "iPhone X"; 57 | case "iPhone10,2": 58 | case "iPhone10,5": 59 | return "iPhone 8 Plus"; 60 | case "iPhone10,1": 61 | case "iPhone10,4": 62 | return "iPhone 8"; 63 | case "iPhone9,2": 64 | case "iPhone9,4": 65 | return "iPhone 7 Plus"; 66 | case "iPhone9,1": 67 | case "iPhone9,3": 68 | return "iPhone 7"; 69 | case "iPhone8,4": 70 | return "iPhone SE"; 71 | case "iPhone8,2": 72 | return "iPhone 6S Plus"; 73 | case "iPhone8,1": 74 | return "iPhone 6S"; 75 | case "iPhone7,1": 76 | return "iPhone 6 Plus"; 77 | case "iPhone7,2": 78 | return "iPhone 6"; 79 | case "iPhone6,2": 80 | return "iPhone 5S Global"; 81 | case "iPhone6,1": 82 | return "iPhone 5S GSM"; 83 | case "iPhone5,4": 84 | return "iPhone 5C Global"; 85 | case "iPhone5,3": 86 | return "iPhone 5C GSM"; 87 | case "iPhone5,2": 88 | return "iPhone 5 Global"; 89 | case "iPhone5,1": 90 | return "iPhone 5 GSM"; 91 | case "iPhone4,1": 92 | return "iPhone 4S"; 93 | case "iPhone3,3": 94 | return "iPhone 4 CDMA"; 95 | case "iPhone3,1": 96 | case "iPhone3,2": 97 | return "iPhone 4 GSM"; 98 | case "iPhone2,1": 99 | return "iPhone 3GS"; 100 | case "iPhone1,2": 101 | return "iPhone 3G"; 102 | case "iPhone1,1": 103 | return "iPhone"; 104 | } 105 | } 106 | 107 | if (hardware.StartsWith("iPod")) 108 | { 109 | switch (hardware) 110 | { 111 | case "iPod9,1": 112 | return "iPod touch 7G"; 113 | case "iPod7,1": 114 | return "iPod touch 6G"; 115 | case "iPod5,1": 116 | return "iPod touch 5G"; 117 | case "iPod4,1": 118 | return "iPod touch 4G"; 119 | case "iPod3,1": 120 | return "iPod touch 3G"; 121 | case "iPod2,1": 122 | return "iPod touch 2G"; 123 | case "iPod1,1": 124 | return "iPod touch"; 125 | } 126 | } 127 | 128 | if (hardware.StartsWith("iPad")) 129 | { 130 | switch (hardware) 131 | { 132 | case "iPad14,2": 133 | return "iPad mini (6th generation) Wi-FI + Cellular"; 134 | case "iPad14,1": 135 | return "iPad mini (6th generation) Wi-FI"; 136 | case "iPad13,11": 137 | return "iPad Pro (12.9-inch) (5th generation) Wi-Fi + Cellular"; 138 | case "iPad13,10": 139 | return "iPad Pro (12.9-inch) (5th generation) Wi-Fi + Cellular"; 140 | case "iPad13,9": 141 | return "iPad Pro (12.9-inch) (5th generation) Wi-Fi"; 142 | case "iPad13,8": 143 | return "iPad Pro (12.9-inch) (5th generation) Wi-Fi"; 144 | case "iPad13,7": 145 | return "iPad Pro (11-inch) (3rd generation) Wi-Fi + Cellular"; 146 | case "iPad13,6": 147 | return "iPad Pro (11-inch) (3rd generation) Wi-Fi + Cellular"; 148 | case "iPad13,5": 149 | return "iPad Pro (11-inch) (3rd generation) Wi-Fi"; 150 | case "iPad13,4": 151 | return "iPad Pro (11-inch) (3rd generation) Wi-Fi"; 152 | case "iPad13,2": 153 | return "iPad Air (4th generation) Wi-Fi + Cellular"; 154 | case "iPad13,1": 155 | return "iPad Air (4th generation) Wi-Fi"; 156 | case "iPad12,2": 157 | return "iPad (9th Generation) Wi-Fi + Cellular"; 158 | case "iPad12,1": 159 | return "iPad (9th generation) Wi-Fi"; 160 | case "iPad11,7": 161 | return "iPad (8th Generation) Wi-Fi + Cellular"; 162 | case "iPad11,6": 163 | return "iPad (8th Generation) Wi-Fi"; 164 | case "iPad11,4": 165 | return "iPad Air (3rd generation) Wi-Fi + Cellular"; 166 | case "iPad11,3": 167 | return "iPad Air (3rd generation) Wi-Fi"; 168 | case "iPad11,2": 169 | return "iPad mini (5th generation) Wi-Fi + Cellular"; 170 | case "iPad11,1": 171 | return "iPad mini (5th generation) Wi-Fi"; 172 | case "iPad8,12": 173 | return "iPad Pro (12.9-inch) (4th generation) Wi-Fi + Cellular"; 174 | case "iPad8,11": 175 | return "iPad Pro (12.9-inch) (4th generation) Wi-Fi"; 176 | case "iPad8,10": 177 | return "iPad Pro (11-inch) (2nd generation) Wi-Fi + Cellular"; 178 | case "iPad8,9": 179 | return "iPad Pro (11-inch) (2nd generation) Wi-Fi"; 180 | case "iPad8,8": 181 | return "iPad Pro 12.9-inch (3rd Generation)"; 182 | case "iPad8,7": 183 | return "iPad Pro 12.9-inch (3rd generation) Wi-Fi + Cellular"; 184 | case "iPad8,6": 185 | return "iPad Pro 12.9-inch (3rd Generation)"; 186 | case "iPad8,5": 187 | return "iPad Pro 12.9-inch (3rd Generation)"; 188 | case "iPad8,4": 189 | return "iPad Pro 11-inch"; 190 | case "iPad8,3": 191 | return "iPad Pro 11-inch Wi-Fi + Cellular"; 192 | case "iPad8,2": 193 | return "iPad Pro 11-inch"; 194 | case "iPad8,1": 195 | return "iPad Pro 11-inch Wi-Fi"; 196 | case "iPad7,12": 197 | return "iPad (7th generation) Wi-Fi + Cellular"; 198 | case "iPad7,11": 199 | return "iPad (7th generation) Wi-Fi"; 200 | case "iPad7,6": 201 | return "iPad (6th generation) Wi-Fi + Cellular"; 202 | case "iPad7,5": 203 | return "iPad (6th generation) Wi-Fi"; 204 | case "iPad7,4": 205 | return "iPad Pro (10.5-inch) Wi-Fi + Cellular"; 206 | case "iPad7,3": 207 | return "iPad Pro (10.5-inch) Wi-Fi"; 208 | case "iPad7,2": 209 | return "iPad Pro 12.9-inch (2nd generation) Wi-Fi + Cellular"; 210 | case "iPad7,1": 211 | return "iPad Pro 12.9-inch (2nd generation) Wi-Fi"; 212 | case "iPad6,12": 213 | return "iPad (5th generation) Wi-Fi + Cellular"; 214 | case "iPad6,11": 215 | return "iPad (5th generation) Wi-Fi"; 216 | case "iPad6,8": 217 | return "iPad Pro 12.9-inch Wi-Fi + Cellular"; 218 | case "iPad6,7": 219 | return "iPad Pro 12.9-inch Wi-Fi"; 220 | case "iPad6,4": 221 | return "iPad Pro (9.7-inch) Wi-Fi + Cellular"; 222 | case "iPad6,3": 223 | return "iPad Pro (9.7-inch) Wi-Fi"; 224 | case "iPad5,4": 225 | return "iPad Air 2 Wi-Fi + Cellular"; 226 | case "iPad5,3": 227 | return "iPad Air 2 Wi-Fi"; 228 | case "iPad5,2": 229 | return "iPad mini 4 Wi-Fi + Cellular"; 230 | case "iPad5,1": 231 | return "iPad mini 4 Wi-Fi"; 232 | case "iPad4,9": 233 | return "iPad mini 3 Wi-Fi + Cellular (TD-LTE)"; 234 | case "iPad4,8": 235 | return "iPad mini 3 Wi-Fi + Cellular"; 236 | case "iPad4,7": 237 | return "iPad mini 3 Wi-Fi"; 238 | case "iPad4,6": 239 | return "iPad mini 2 Wi-Fi + Cellular (TD-LTE)"; 240 | case "iPad4,5": 241 | return "iPad mini 2 Wi-Fi + Cellular"; 242 | case "iPad4,4": 243 | return "iPad mini 2 Wi-Fi"; 244 | case "iPad4,3": 245 | return "iPad Air Wi-Fi + Cellular (TD-LTE)"; 246 | case "iPad4,2": 247 | return "iPad Air Wi-Fi + Cellular"; 248 | case "iPad4,1": 249 | return "iPad Air Wi-Fi"; 250 | case "iPad3,6": 251 | return "iPad (4th generation) Wi-Fi + Cellular (MM)"; 252 | case "iPad3,5": 253 | return "iPad (4th generation) Wi-Fi + Cellular"; 254 | case "iPad3,4": 255 | return "iPad (4th generation) Wi-Fi"; 256 | case "iPad3,3": 257 | return "iPad 3 Wi-Fi + Cellular (CDMA)"; 258 | case "iPad3,2": 259 | return "iPad 3 Wi-Fi + Cellular (GSM)"; 260 | case "iPad3,1": 261 | return "iPad 3 Wi-Fi"; 262 | case "iPad2,7": 263 | return "iPad mini Wi-Fi + Cellular (MM)"; 264 | case "iPad2,6": 265 | return "iPad mini Wi-Fi + Cellular"; 266 | case "iPad2,5": 267 | return "iPad mini Wi-Fi"; 268 | case "iPad2,4": 269 | return "iPad 2 Wi-Fi"; 270 | case "iPad2,3": 271 | return "iPad 2 CDMA"; 272 | case "iPad2,2": 273 | return "iPad 2 GSM"; 274 | case "iPad2,1": 275 | return "iPad 2 Wi-Fi"; 276 | case "iPad1,1": 277 | return "iPad"; 278 | } 279 | } 280 | 281 | if (hardware == "i386" || hardware == "x86_64") 282 | return "Simulator"; 283 | 284 | if (hardware == "mac") 285 | return "Mac"; 286 | 287 | return (hardware == "" ? "Unknown" : hardware); 288 | } 289 | } 290 | } 291 | --------------------------------------------------------------------------------