static void tests(void) { // CFStringRef messageToUser = CFSTR("OK to sync with world?"); // CFStringRef messageToUser = CFSTR("Allow “Emily‘s iPad to use your iCloud Keychain?"); #if !TARGET_IPHONE_SIMULATOR #if TARGET_OS_EMBEDDED CFStringRef our_peer_id = (CFStringRef)MGCopyAnswer(kMGQUserAssignedDeviceName, NULL); #else CFStringRef our_peer_id = CFSTR("🔥💩"); #endif #else CFStringRef our_peer_id = CFSTR("Emily‘s iPad"); #endif CFStringRef messageToUser = CFStringCreateWithFormat(kCFAllocatorDefault, 0, CFSTR("Allow “%@” to use your iCloud Keychain?"), our_peer_id); dispatch_queue_t processQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); dispatch_group_t work_group = dispatch_group_create(); // Prep the group for exitting the whole shebang. dispatch_group_enter(work_group); dispatch_group_notify(work_group, processQueue, ^ { printf("Exiting via dispatch_group_notify; all work done\n"); CFRunLoopStop(CFRunLoopGetMain()); // exit(0); });
CFTypeRef _MGCopyAnswer(CFStringRef KeyToCopy) { CFTypeRef ReturnData; if (!CFStringCompare(KeyToCopy, CFSTR("PanoramaCameraCapability"), 0)) return kCFBooleanTrue; ReturnData = MGCopyAnswer(KeyToCopy); return ReturnData; }