Getting Values ​​from CFDictionary

I am new to Objective-C programming and wondered if I can get some help.

I am trying to access values ​​from CFDictionary. I started by implementing the code suggested in this question

 CFTypeRef r = IOPSCopyPowerSourcesInfo();
 CFArrayRef array = IOPSCopyPowerSourcesList(r);
 CFDictionaryRef powerDic = IOPSGetPowerSourceDescription(array, r);

and I looked through the documentation plus other posts , but this is a little outside of me how it works.

I really need an example code that takes the code that I already have and uses it to print a string, such as Current Capacity.

Any help?

+5
source share
1 answer

CFDictionaryRef " " NSDictionary. , . :

...
NSDictionary * powerDic = (NSDictionary *)IOPSGetPowerSourceDescription(array, r);
NSString * aValue = [powerDic objectForKey:@"aKey"];

( - ) CoreFoundation ( ), - CFDictionaryGetValue().

+11

All Articles