Code Monkey home page Code Monkey logo

get-ios-model's People

Contributors

adamzucchi avatar corenion avatar dannycabrera avatar follesoe avatar jimbobbennett avatar sven-s avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

get-ios-model's Issues

Apple store App reject reading via Marshal the hw.machine property (?)

Hi Dany,

(First of all, sorry if this is not the best way to ask this question, but i am quite new to GitHub :/ )
I am glad i found your package (got the reference from @LandLu in Xamarin Forums ๐Ÿ‘ ).

Now, i came across this way of obtaining the iOS model before in another thread of Xamarin Forums, where @johnhardman shares code from XLabs. There, the user who asks the question draws attention over the fact that "reading via Marshal the hw.machine property ... could be interfere with the Apple Guidelines because you use not free to use SDK abilities. This could result in a permanent suspension of your account."

Could you share what you know about this and if it is secure to use your library/code in my App?

Thanks,

Julipan

Add support for iOS app running on macOS M1 computers

Starting with the new M1 computers, macOS can now run unmodified iOS applications on macOS.

I tested this using our app, and running on my M1 Mac Mini it reported the following device type: iPad Pro 12.9 inch (3rd Generation).

I have not had a closer look yet, but it could either be something on the mapping or in the returned model number from the API (for compatibility reasons).

However, there is an isiOSAppOnMac property we could use to detect this case, and as a minimum returning data suggesting it is running on a Mac: https://developer.apple.com/documentation/foundation/processinfo/3608556-isiosapponmac

iPhone 12 references

As found in Xcode 12.2 beta 3:

                // ************
                // iPhone 12 mini
                // ************
                // Model(s): A2176
                // Apple Tech specs: unknown
                if (hardware == "iPhone13,1")
                    return "iPhone 12 mini";

                // ************
                // iPhone 12
                // ************
                // Model(s): A2172
                // Apple Tech specs: unknown
                if (hardware == "iPhone13,2")
                    return "iPhone 12";

                // ************
                // iPhone 12 Pro
                // ************
                // Model(s): A2341
                // Apple Tech specs: unknown
                if (hardware == "iPhone13,3")
                    return "iPhone 12 Pro";

                // ************
                // iPhone 12 Pro Max
                // ************
                // Model(s): A2342
                // Apple Tech specs: unknown
                if (hardware == "iPhone13,4")
                    return "iPhone 12 Pro Max";

iPhone 11 codes

                 // Apple Tech specs: https://support.apple.com/kb/SP779
                 if (hardware == "iPhone11,2")
                     return "iPhone Xs";
+
+                if (hardware == "iPhone12,3")
+                    return "iPhone 11 Pro";
+
+                if (hardware == "iPhone12,5")
+                    return "iPhone 11 Pro Max";
+
+                if (hardware == "iPhone12,1")
+                    return "iPhone 11";
             }
 
             if (hardware.StartsWith("iPod"))

iPhone 7 & iPhone 7 Plus Hardware Strings

First, thank you so much for creating and supporting this library! :)

Do we have any clues as to what the iPhone 7 and iPhone 7 Plus hardware strings will be?

Or do we need to wait until the official launch of the phones on 9/16/16?

iPhone 13/14 references (incl. new iPad)

as found in Contents/Developer/Platforms/iPhoneOS.platform/usr/standalone/device_traits.db:

    case "iPhone14,2":
        return "iPhone 13 Pro";
    case "iPhone14,3":
        return "iPhone 13 Pro Max";
    case "iPhone14,4":
        return "iPhone 13 mini";
    case "iPhone14,5":
        return "iPhone 13";

which does not follow the same logic as for iPhone 12 but is in line with a comment I found here: https://gist.github.com/adamawolf/3048717#gistcomment-3894325

Furthermore, in this file as well, and based on other iPads for detailed feature:

    case "iPad14,2":
        return "iPad mini (6th generation) Wi-Fi + Cellular";
    case "iPad14,1":
        return "iPad mini (6th generation) Wi-Fi";

and

    case "iPad12,2":
        return "iPad (9th generation) Wi-Fi + Cellular";
    case "iPad12,1":
        return "iPad (9th generation) Wi-Fi";

ChipType not visible

ChipType is marked as private in the latest (and other previous) version of the NuGet package, so this example given in the readme doesn't work:

Console.WriteLine(Xamarin.iOS.DeviceHardware.ChipType);

Or have I misunderstood something here?

Thanks!

Mapping from model to chip type

I have created a mapping from model to Apple CPU type for all model numbers. Normally this should not be too relevant, but because of issues with Apple Wireless Direct Link, and how this protocol behaves in certain chips (pre A10, which does not have dual Wi-Fi radio), this information is needed in my app.

The data set looks like this:

modelChipMap = new Dictionary<string, AppleChipType>
{
	{ "iPhone1,1", AppleChipType.A4 }, // iPhone
	{ "iPhone1,2", AppleChipType.A4 }, // iPhone 3G
	{ "iPhone2,1", AppleChipType.A4 }, // iPhone 3GS
	{ "iPhone3,1", AppleChipType.A4 }, // iPhone 4 GSM
	{ "iPhone3,2", AppleChipType.A4 }, // iPhone 4 GSM
	{ "iPhone3,3", AppleChipType.A4 }, // iPhone 4 CDMA
	{ "iPhone4,1", AppleChipType.A5 }, // iPhone 4S
	{ "iPhone5,1", AppleChipType.A6 }, // iPhone 5 GSM
	{ "iPhone5,2", AppleChipType.A6 }, // iPhone 5 Global
	{ "iPhone5,3", AppleChipType.A6 }, // iPhone 5C GSM
	{ "iPhone5,4", AppleChipType.A6 }, // iPhone 5C Global,
	{ "iPhone6,1", AppleChipType.A7 }, // iPhone 5S GSM
	{ "iPhone6,2", AppleChipType.A7 }, // iPhone 5S Global
	{ "iPhone7,1", AppleChipType.A8 }, // iPhone 6 Plus
	{ "iPhone7,2", AppleChipType.A8 }, // iPhone 6
	{ "iPhone8,1", AppleChipType.A9 }, // iPhone 6S,
	{ "iPhone8,2", AppleChipType.A9 }, // iPhone 6S Plus,
	{ "iPhone8,4", AppleChipType.A9 }, // iPhone SE,
	{ "iPhone9,1", AppleChipType.A10Fusion }, // iPhone 7
	{ "iPhone9,2", AppleChipType.A10Fusion }, // iPhone 7 Plus
	{ "iPhone9,3", AppleChipType.A10Fusion }, // iPhone 7
	{ "iPhone9,4", AppleChipType.A10Fusion }, // iPhone 7 Plus
	{ "iPhone10,1", AppleChipType.A11Bionic }, // iPhone 8
	{ "iPhone10,2", AppleChipType.A11Bionic }, // iPhone 8 Plus
	{ "iPhone10,3", AppleChipType.A11Bionic }, // iPhone X
	{ "iPhone10,4", AppleChipType.A11Bionic }, // iPhone 8
	{ "iPhone10,5", AppleChipType.A11Bionic }, // iPhone 8 Plus
	{ "iPhone10,6", AppleChipType.A11Bionic }, // iPhone X
	{ "iPhone11,2", AppleChipType.A12Bionic }, // iPhone XS
	{ "iPhone11,4", AppleChipType.A12Bionic }, // iPhone XS Max
	{ "iPhone11,6", AppleChipType.A12Bionic }, // iPhone XS Max
	{ "iPhone11,8", AppleChipType.A12Bionic }, // iPhone XR
	{ "iPad1,1", AppleChipType.A4 }, // iPad
	{ "iPad2,1", AppleChipType.A5 }, // iPad 2 Wi-Fi
	{ "iPad2,2", AppleChipType.A5 }, // iPad 2 GSM
	{ "iPad2,3", AppleChipType.A5 }, // iPad 2 CDMA
	{ "iPad2,4", AppleChipType.A5 }, // iPad 2 Wi-Fi
	{ "iPad2,5", AppleChipType.A5 }, // iPad mini Wi-Fi
	{ "iPad2,6", AppleChipType.A5 }, // iPad mini Wi-Fi + Cellular
	{ "iPad2,7", AppleChipType.A5 }, // iPad mini Wi-Fi + Cellular (MM)
	{ "iPad3,1", AppleChipType.A5 }, // iPad 3 Wi-Fi
	{ "iPad3,2", AppleChipType.A5 }, // iPad 3 Wi-Fi + Cellular (VZ)
	{ "iPad3,3", AppleChipType.A5X }, // iPad 3 Wi-Fi + Cellular
	{ "iPad3,4", AppleChipType.A6X }, // iPad 4 Wi-Fi
	{ "iPad3,5", AppleChipType.A6X }, // iPad 4 Wi-Fi + Cellular
	{ "iPad3,6", AppleChipType.A6X }, // iPad 4 Wi-Fi + Cellular (MM)
	{ "iPad4,1", AppleChipType.A7 }, // iPad Air Wi-Fi
	{ "iPad4,2", AppleChipType.A7 }, // iPad Air Wi-Fi + Cellular
	{ "iPad4,3", AppleChipType.A7 }, // iPad Air Wi-Fi + Cellular (TD-LTE)
	{ "iPad4,4", AppleChipType.A7 }, // iPad mini 2 Wi-Fi
	{ "iPad4,5", AppleChipType.A7 }, // iPad mini 2 Wi-Fi + Cellular
	{ "iPad4,6", AppleChipType.A7 }, // iPad mini 2 Wi-Fi + Cellular (TD-LTE)
	{ "iPad4,7", AppleChipType.A7 }, // iPad mini 3 Wi-Fi
	{ "iPad4,8", AppleChipType.A7 }, // iPad mini 3 Wi-Fi + Cellular
	{ "iPad4,9", AppleChipType.A7 }, // iPad mini 3 Wi-Fi + Cellular (TD-LTE)
	{ "iPad5,1", AppleChipType.A8 }, // iPad mini 4 Wi-Fi
	{ "iPad5,2", AppleChipType.A8 }, // iPad mini 4 Wi-Fi + Cellular
	{ "iPad5,3", AppleChipType.A8X }, // iPad Air 2 Wi-Fi
	{ "iPad5,4", AppleChipType.A8X }, // iPad Air 2 Wi-Fi + Cellular
	{ "iPad6,3", AppleChipType.A9X }, // iPad Pro 9.7" Wi-Fi
	{ "iPad6,4", AppleChipType.A9X }, // iPad Pro 9.7" Wi-Fi + Cellular
	{ "iPad6,7", AppleChipType.A9X }, // iPad Pro 12.9" Wi-Fi
	{ "iPad6,8", AppleChipType.A9X }, // iPad Pro 12.9" Wi-Fi + Cellular
	{ "iPad6,11", AppleChipType.A9 }, // iPad 5th gen Wi-Fi
	{ "iPad6,12", AppleChipType.A9 }, // iPad 5th gen Wi-Fi + Cellular
	{ "iPad7,1", AppleChipType.A10XFusion }, // iPad Pro 12.9" 2nd gen Wi-Fi
	{ "iPad7,2", AppleChipType.A10XFusion }, // iPad Pro 12.9" 2nd gen Wi-Fi + Cellular
	{ "iPad7,3", AppleChipType.A10XFusion }, // iPad Pro 10.5" Wi-Fi
	{ "iPad7,4", AppleChipType.A10XFusion }, // iPad Pro 10.5" Wi-Fi + Cellular
	{ "iPad7,5", AppleChipType.A10XFusion }, // iPad 9.7" 6th gen Wi-Fi
	{ "iPad7,6", AppleChipType.A10XFusion }, // iPad 9.7" 6th gen Wi-Fi + Cellular
	{ "iPad8,1", AppleChipType.A12XBionic }, // iPad Pro 11" Wi-Fi
	{ "iPad8,2", AppleChipType.A12XBionic }, // iPad Pro 11" Wi-Fi
	{ "iPad8,3", AppleChipType.A12XBionic }, // iPad Pro 11" Wi-Fi + Cellular
	{ "iPad8,4", AppleChipType.A12XBionic }, // iPad Pro 11" Wi-Fi + Cellular
	{ "iPad8,5", AppleChipType.A12XBionic }, // iPad Pro 12.9" 3nd gen Wi-Fi
	{ "iPad8,6", AppleChipType.A12XBionic }, // iPad Pro 12.9" 3nd gen Wi-Fi
	{ "iPad8,7", AppleChipType.A12XBionic }, // iPad Pro 12.9" 3nd gen Wi-Fi + Cellular
	{ "iPad8,8", AppleChipType.A12XBionic }, // iPad Pro 12.9" 3nd gen Wi-Fi + Cellular
	{ "iPad11,1", AppleChipType.A12Bionic }, // iPad mini 5 Wi-Fi
	{ "iPad11,2", AppleChipType.A12Bionic }, // iPad mini 5 Wi-Fi + Cellular
	{ "iPad11,3", AppleChipType.A12Bionic }, // iPad Air 3rd gen Wi-Fi
	{ "iPad11,4", AppleChipType.A12Bionic }, // iPad Air 3rd gen Wi-Fi + Cellular
	{ "iPod1,1", AppleChipType.A4 }, // iPod Touch
	{ "iPod2,1", AppleChipType.A4 }, // iPod Touch 2st gen
	{ "iPod3,1", AppleChipType.A4 }, // iPod Touch 3rd gen
	{ "iPod4,1", AppleChipType.A4 }, // iPod Touch 4th gen
	{ "iPod5,1", AppleChipType.A5 }, // iPod Touch 5th gen
	{ "iPod7,1", AppleChipType.A8 }, // iPod Touch 6th gen
	{ "iPod7,1", AppleChipType.A10Fusion }, // iPod Touch 7th gen
};

This could easily be added as property such as Xamarin.iOS.DeviceHardware.ChipType. If you think this would be relevant for this library, I can implement it and send a pull request.

Created this issue first to discuss this possible feature.

Proposal: JSON meta for lookup

Currently everytime Apple releases a new iPhone/iPad model, you have to update the C# codes and make a package release.

It may be more flexible and less overhead to store the mappings in a JSON file which will be loaded into a Dictionary structure.

Actually, in iOSChipTypeMap.cs you already have a Dictionary for mapping hardware ID to chip type.

The proposed JSON structure is like:

{
  "iPad11,3": {
    "chip": "A10Fusion",
    "model": ""iPad Air 3 Wi-Fi",
  },
  
  "iPad11,4": {
...
  }
}

The JSON file is by default staying with the package assembly which will load the JSON file in this location.

So in the future when new iPhone/iPad model comes out, the application developers just needs to update the JSON file.

Aftermath of such change:
And through such allocation of meta data, you may even create a simple Web service that provides the mappings. And an iOS app may locate the mappings in the local JSON file. If not found, then the app talks to the Web service to find the latest mappings. So app developers don't have to build and release everytime a new iPhone/iPad model comes out.

If you accept this proposal, you may assign to one of the existing contributors, or I can fork and raise a pull request later.

No license

Hi Danny,
I'm interested in using your Get-iOS-Model code in a project I'm working on, but don't see any licensing listed. Can you please add licensing information so we know if it fits in our model?
Thanks!
Kyle

[Enhancement] .NET Standard support

Is there any way this library could support .NET Standard? Not sure if it's possible, but it would be great to be able to use this from a class library.

Love the work, by the way!

Unable to install Nuget package version 1.11.0

I am unable to add the 1.11.0 Nuget package to my .NET Framework 4.7 project. I'm getting the following error:

Install-Package : Failed to add reference. The package 'dannycabrera.GetiOSModel' tried to add a framework reference to 
'System.Drawing.Common.dll' which was not found in the GAC. This is possibly a bug in the package. Please contact the package 
owners for assistance.
  Reference unavailable.

I tried installing System.Drawing.Common manually, but I'm still getting the same error.

It is also worth noting that I can install 1.10.0. That version does throw this error.

Not able to detect the simulator model version

Hello,

When running the application on the simulator I get wrong values such as:

Xamarin.iOS.DeviceHardware.Version => x64
Xamarin.iOS.DeviceHardware.Model => Simulator

However, we don't have all physical phones for testing so we use the simulators. Is it possible to return on simulators the model used for testing? For example: "iPhone X, Simulator" appending the word simulator at the end of it? only when simulator or something different.

Thanks in advance for the amazing work,
Victor

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.