Search code examples
cocoacfstringcfdata

CFData vs CFString


I have a CFMutableDictionaryRef, part of which in debugger is:

"device-id" = <72270000>;

model = <474d4120 39353000>;

"vendor-id" = <86800000>;

Now I can get value of the key model using CFDataRef which returns string like "GMA 950", as compared to the value above.

But I cannot get value of "vendor-id"using same method so I try with CFString, which returns <86800000> instead of a string. So how to retreive correct value of the vendor id (which I already know should return 0x8086 for Intel) ??


Solution

  • found it:

    have to format the string retreived with CFString as:

    NSString *id = [NSString stringWithFormat:@"0x%X",*((UInt32*)CFDataGetBytePtr(cfstr))];