Created
September 27, 2012 19:18
-
-
Save iburlakov/3795877 to your computer and use it in GitHub Desktop.
Using of CFDictionaryGetValueIfPresent
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CFDictionaryRef dict; | |
/* | |
Get some dictionary... | |
*/ | |
SInt32 intVal = 0; | |
CFNumberRef cfIntVal; | |
char* strVal; | |
CFStringRef cfStrVal; | |
if(CFDictionaryGetValueIfPresent(dict, CFSTR("SomeKey0"), &cfIntVal) && | |
CFDictionaryGetValueIfPresent(dict, CFSTR("SomeKey1"), &cfStrVal) | |
{ | |
CFNumberGetValue(cfIntVal, kCFNumberSInt32Type, &intVal); | |
CFStringEncoding encodingMethod = CFStringGetSystemEncoding(); | |
strVal = CFStringGetCStringPtr(cfStrVal, encodingMethod); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment