USB HID デバイスとインターフェイスする Mac アプリケーションを作成しています。まず、自分のデバイスの仕様に一致するデバイスがいくつ見つかったかを出力しようとしています。
//Create a HID Manager
IOHIDManagerRef hidManager = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone);
//Create a dictionary and limit it to the uPPT
CFMutableDictionaryRef dict = CFDictionaryCreateMutable (kCFAllocatorDefault, 1, &kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
CFDictionarySetValue(dict, CFSTR("VendorID"), CFSTR("0x04D8"));
CFDictionarySetValue(dict, CFSTR("ProductID"), CFSTR("0x0054"));
IOHIDManagerSetDeviceMatching(hidManager, dict);
CFSetRef devSet = IOHIDManagerCopyDevices (hidManager);
CFIndex numDevices = CFSetGetCount(devSet);
NSLog(@"%ld uPPTs found", numDevices);
残念ながら、これは CFSetGetCount(devSet) でクラッシュします。私が知る限り、これを正しく使用していますが、アプリケーションがハングし、「Thread 1: EXC_BAD_ACCESS (Code=1, Address=0x0)」が表示されます。何か案は?ありがとう