I need to send keystrokes from Today Extension App, so I wrote like this.
CGEventSourceRef source = CGEventSourceCreate(kCGEventSourceStateHIDSystemState);
CGEventRef f4 = CGEventCreateKeyboardEvent(source, kVK_F4, true);
CGEventSetFlags(f4, kCGEventFlagMaskControl);
CGEventTapLocation location = kCGHIDEventTap;
CGEventPost(location, f4);
CFRelease(f4);
CFRelease(source);`
and I wrote 'com.apple.systemevents' in the .entitlements file.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.temporary-exception.apple-events</key>
<array>
<string>com.apple.systemevents</string>
</array>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.files.user-selected.read-only</key>
<true/>
</dict>
</plist>
But, It didn't work.
Please tell me how to do this.
Thanks.