This file contains 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
NSString *HexNSStringFromBytes(uint8_t *bytes, NSUInteger count) { | |
char *hexCString = calloc(count * 2 + 1, sizeof(char *)); | |
static char hexLookup[] = "0123456789abcdef"; | |
NSMutableString* testString = [NSMutableString string]; | |
for (int i = 0; i < count; ++i) { | |
uint8_t fullByte = bytes[i]; | |
// each byte converts to two hex characters |
This file contains 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
BOOL ProtocolContainsInstanceSelector(NSString *protocolName, SEL sel); | |
BOOL ProtocolContainsInstanceSelector(NSString *protocolName, SEL sel) | |
{ | |
Protocol *p = objc_getProtocol([protocolName cStringUsingEncoding:NSUTF8StringEncoding]); | |
// must check for both required = {YES, NO} | |
struct objc_method_description desc = protocol_getMethodDescription(p, sel, YES, YES); | |
BOOL contains = desc.name != NULL && desc.types != NULL; | |
if (!contains) { |
NewerOlder