unsigned char _MyString[] = {0xda, 0xe5, 0x18, ..., 0x00};
CFArrayRef array = CFArrayCreate(NULL,
(const void**) CFStringCreateWithBytes(NULL,
_MyString,
sizeof(_MyString),
kCFStringEncodingASCII,
FALSE),
1,
&kCFTypeArrayCallBacks);
CFShow(arr); // <-- EXEC_BAD_ACCESS ERROR
The debugger shows its failing in
CoreFoundation`CFGetTypeID:
Output from debugger
__NSCFString
(lldb)
I’m not sure where the memory error is, I think it must be due to the passing of the string in CFArrayCreate().
Casting the return value of CFStringCreateWithBytes to a const void ** is incorrect, which is why it’s crashing. It’s not a pointer to a pointer, it’s a pointer to a CFString.