NSPipe *outputPipe = [NSPipe pipe];NSTask *task = [[NSTask alloc]
init];[task setLaunchPath:@"/usr/sbin/system_profiler"];[task
setArguments:@[@"SPHardwareDataType"]];[task
setStandardOutput:outputPipe];[task launch];[task
waitUntilExit];NSData *outputData = [[outputPipe fileHandleForReading]
readDataToEndOfFile];NSString *hardware = [[NSString alloc]
initWithData:outputData encoding:NSUTF8StringEncoding];


Mareks-MacBook-Pro:~ xhruso00$ /usr/sbin/system_profiler SPHardwareDataType

Hardware:


    Hardware Overview:


      Model Name: MacBook Pro

      Model Identifier: MacBookPro6,2

      Processor Name: Intel Core i5

      Processor Speed: 2,4 GHz

      Number of Processors: 1

      Total Number of Cores: 2

      L2 Cache (per Core): 256 KB

      L3 Cache: 3 MB

      Memory: 8 GB

      Processor Interconnect Speed: 4,8 GT/s

      Boot ROM Version: MBP61.0057.B10

      SMC Version (system): 1.58f17

      Serial Number (system): hidden

      Hardware UUID: hidden

      Sudden Motion Sensor:

          State: Enabled

On Mon, Sep 14, 2015 at 10:17 AM, Robert Tillyard <r...@atvetsystems.com>
wrote:

> 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 <etresoft.apple.li...@icloud.com>
> 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 (Cocoa-dev@lists.apple.com)
>
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/xhruso00%40gmail.com
>
> This email sent to xhrus...@gmail.com
>
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to