• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Identifying a specific Mac model
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Identifying a specific Mac model


  • Subject: Re: Identifying a specific Mac model
  • From: Robert Tillyard <email@hidden>
  • Date: Mon, 14 Sep 2015 09:17:54 +0100

Hello, John,

I use this to get the model number:


+ (NSString *)computerModel
{
	char modelBuffer[256];
	size_t sz = sizeof(modelBuffer);

	if (0 == sysctlbyname("hw.model", modelBuffer, &sz, NULL, 0)) {
		modelBuffer[sizeof(modelBuffer) - 1] = 0;
		return [NSString stringWithCString:modelBuffer encoding:[NSString defaultCStringEncoding]];
	}

	return nil;
}

Regards, Rob.


> On 14 Sep 2015, at 01:09, John Daniel <email@hidden> wrote:
>
> Hello,
> Does anyone know of an API or utility that will identify specific Mac models? The “Model Identifier” like “MacBook8,1” is not sufficient to uniquely describe a model. MacBook8,1 covers all colours of the new  MacBook. I am trying to differentiate the silver, from the space grey, from the gold.
>
> My app has an animation where it cycles through various Macs like a slot machine, finally landing on the user’s specific machine. I used to just look at the “Model Identifier”. I could pretty easily identify the matching machine image from /System/Library/CoreServices/CoreTypes.bundle/Contents/Resources.
>
> However, the images for the new retina MacBook are in a different location. I found where they live in an apparently randomly-named framework, but I still can’t connect a specific image with the user’s specific machine. There is a private API for the UIDevice class in iOS that provides similar information. Is there anything like this for the Mac?
>
> Thanks,
>
> John Daniel
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Identifying a specific Mac model
      • From: Marek Hrušovský <email@hidden>
References: 
 >Identifying a specific Mac model (From: John Daniel <email@hidden>)

  • Prev by Date: Re: Display USB Video Camera output : AVFoundation?
  • Next by Date: Re: Identifying a specific Mac model
  • Previous by thread: Identifying a specific Mac model
  • Next by thread: Re: Identifying a specific Mac model
  • Index(es):
    • Date
    • Thread