Hi Jason,
Thank you for following this/these up. I've had a response from a DTS engineer, who has confirmed the issue and passed it on to the CG team.
With regard to the other reports, as I mentioned, I can workaround the move bugs in mixed meter if the absolute positioning by bars, beats, divisions, ticks command is implemented in the device interface. This should be trivial as the functionality already exists in the UI, and by implication in the engine. This is the ideal resolution to all these issues, for me at least.
I have spent years on the development of my product part time, and over the last few months I've dedicated myself full time to this to give it the last push to get into production. I appreciate these things don't happen overnight, but to hear that it could take years or not at all is disappointing.
Thanks again for looking into this for me.
Cheers,
Stew
Post
Replies
Boosts
Views
Activity
Hi Jason,
I appreciate that the team is no doubt very busy which is why I've interpreted "three days" to be "three weeks" - being typically realistic:)
My case number is 1583582 "Application (Logic) not responding to CGEventPostToPid when without focus".
I've also posted on the forum, https://developer.apple.com/forums/thread/724835 "CGEventPostToPid not posting to background app's open dialog".
Please also note, that I discovered this whilst implementing a work around with issues positioning the playhead via Logic's Control Surface Midi Device Plugin.
Here are my previous submissions related to this:
https://developer.apple.com/forums/thread/706826 "Logic Pro Position Playhead Controller Assignment Bug?"
FB11998352 Move playhead by bars doesn't take into account multiple time signatures
FB12009078 Move By Divisions Doesn't Work
FB12011386 Move By Ticks Doesn't Work
All of these issues, including the attendant one, would go away (for me at least!) if the following request is implemented:
FB11998414 Midi Device Plugin - Go To Position (Bars, Beats, Divisions, Ticks) Command Request
This functionality is what I'm cludging via posting events to the UI version of this function. Given that the UI functionality (and by implication Logic's engine) exists, it should be trivial to implement this.
It would be nice to know if someone is "scratching their head", on any of these.
Thanks for looking into this.
Cheers
Stew
FYI - please see https://developer.apple.com/forums//thread/726440?answerId=747919022#747919022 for the solution to the mkstemp error problem.
Hi Quinn,
Good news, and bad news - after building the dummy dylib and running vtool against it - it worked. Furthermore, when I reran vtool against my libraries, it worked too!
I guess it must have set the temp path somehow? Another mystery!
The bad news is that the library (which is not one that I've "fixed") still doesn't load when codesigned - it works fine without it.
Back to reading your notes - I'll create another post after that...
Thanks,
Stew
Hi Quinn,
Yes, I have been reading and following your guidelines to the letter...they're most helpful - thanks. However I'm stuck with this workaround!
I'm not using any CI Tools (apart from using Smalltalk scripts to run the Command Line tools directly). (Note, I get this problem when running manually from the command line).
All the tools have worked fine so far (both on terminal and via script), apart from this instance.
My setup is macOS 12.0.1 with Xcode 13.1.
Yes, that's my conclusion as well, except I don't know how to configure the temporary directory for mkstemp/Command Line tools? Would I do this through Xcode, or some other environment variable? I guess if I new the directory it was trying to use, maybe I could just create it? I've checked the various $TMPDIR, and ~/Library/Caches and there are some com.apple.dt... files there, including Xcode.
Or it could be permissions/space issue? This post https://stackoverflow.com/questions/16996125/no-usable-temporary-directory-found suggested running df -h and df -i. This doesn't seem to be an issue for me though.
Thanks,
Stew
OK, I figured it out.
For example:
vtool -set-build-version macos 12.0 12.0 -replace -output "/Volumes/Data/Projects/MyApp/Pharo/Builds/1.0.0/Bundle/intel64/MyApp.app/Contents/MacOS/PluginsFixed/libUnixOSProcessPlugin.dylib" "/Volumes/Data/Projects/MyApp/Pharo/Builds/1.0.0/Bundle/intel64/MyApp.app/Contents/MacOS/Plugins/libUnixOSProcessPlugin.dylib"
Unfortunately, I'm getting an error:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/vtool error: mkstemp: No such file or directory
I've created the output directory and confirmed I have the right path for the input file.
I suspect this is a command line tools configuration problem when creating a temp file, and will create a new post.
`vtool -help
usage: vtool [-arch <arch>] ... <show_command> <file>
vtool [-arch <arch>] ... <set_command> ... [-replace] [-output <output>] <file>
vtool [-arch <arch>] ... <remove_command> ... [-output <output>] <file>
vtool -help
show_command is exactly one of:
-show
-show-build
-show-source
-show-space
set_command is one or more of:
-set-build-version <platform> <minos> <sdk> [-tool <tool> <version>] ...
-set-build-tool <platform> <tool> <version>
-set-version-min <platform> <minos> <sdk>
-set-source-version <version>
remove_command is one or more of:
-remove-build-version <platform>
-remove-build-tool <platform> <tool>
-remove-source-version
platform is one of:
macos
ios
watchos
tvos
bridgeos
maccatalyst
uikitformac
iossim
watchossim
driverkit
tool is one of:
clang
swift
ld
platform and tool can also be specified by number
`
Thanks - that was exactly what was happening - all fixed now!
Answering my own question:
It does this when the app hasn't been codesigned. Once code signed it shows as the app, not the launcher executable.
Still don't now why though - one of life's little mystery's!
I've been getting to grips with TCC and have found the links below useful.
I've yet to resort to the "nuclear" option of deleting the tcc database though!
You could also try: sudo tccutil reset All com.vendor.appname
https://eclecticlight.co/2018/11/20/what-does-the-tcc-compatibility-database-do/
https://www.rainforestqa.com/blog/macos-tcc-db-deep-dive
https://recoursive.com/2020/03/03/reset_macos_privacy_permissions/
https://eclecticlight.co/2023/02/09/should-you-reset-its-database-or-delete-it-the-woes-of-tcc/
https://www.macworld.com/article/1378183/how-to-reset-macos-privacy-preferences-when-other-options-dont-work.html
FYI to get a list of all the Services use this (works for Monterey, you may need to change the path):
strings /System/Library/PrivateFrameworks/TCC.framework/Versions/A/Resources/tccd | fgrep kTCCService | fgrep -v ' ' | sed -e s/kTCCService// | sort
I adapted the magic command referenced by: https://recoursive.com/2020/03/03/reset_macos_privacy_permissions/ on Monterey generate the list below.
Hope this helps...
strings /System/Library/PrivateFrameworks/TCC.framework/Versions/A/Resources/tccd | fgrep kTCCService | fgrep -v ' ' | sed -e s/kTCCService// | sort
Accessibility
AddressBook
All
AlwaysAllowedService.AppleEvents
AppleEvents
BluetoothAlways
BluetoothPeripheral
BluetoothWhileInUse
Calendar
Calls
Camera
ContactsFull
ContactsLimited
DeveloperTool
ExposureNotification
ExposureNotificationRegion
FaceID
Facebook
FallDetection
FileProviderDomain
FileProviderPresence
FocusStatus
GameCenterFriends
KeyboardNetwork
LinkedIn
ListenEvent
Liverpool
MSO
MediaLibrary
Microphone
Motion
NearbyInteraction
Photos
PhotosAdd
PostEvent
Prototype3Rights
Prototype4Rights
Reminders
ScreenCapture
SensorKitAmbientLightSensor
SensorKitBedSensing
SensorKitBedSensingWriting
SensorKitDeviceUsage
SensorKitElevation
SensorKitFacialMetrics
SensorKitForegroundAppCategory
SensorKitKeyboardMetrics
SensorKitLocationMetrics
SensorKitMessageUsage
SensorKitMotion
SensorKitMotionHeartRate
SensorKitOdometer
SensorKitPedometer
SensorKitPhoneUsage
SensorKitSoundDetection
SensorKitSpeechMetrics
SensorKitStrideCalibration
SensorKitWatchAmbientLightSensor
SensorKitWatchFallStats
SensorKitWatchForegroundAppCategory
SensorKitWatchHeartRate
SensorKitWatchMotion
SensorKitWatchOnWristState
SensorKitWatchPedometer
SensorKitWatchSpeechMetrics
ShareKit
SinaWeibo
Siri
SpeechRecognition
SystemPolicyAllFiles
SystemPolicyDesktopFolder
SystemPolicyDeveloperFiles
SystemPolicyDocumentsFolder
SystemPolicyDownloadsFolder
SystemPolicyNetworkVolumes
SystemPolicyRemovableVolumes
SystemPolicySysAdminFiles
TencentWeibo
Twitter
Ubiquity
UserAvailability
UserTracking
WebKitIntelligentTrackingPrevention
Willow
Please note that I've opened a new post regarding sending events without switching focus to avoid the flashing using CGEventPostToPid, which doesn't seem to work.
See https://developer.apple.com/forums/thread/724835
Good news!
I was about to do a reset using "sudo tccutil reset Accessibility" as described in https://www.macworld.com/article/347452/how-to-fix-macos-accessibility-permission-when-an-app-cant-be-enabled.html, and it suddenly started to work!. Not sure what I did differently, but as the article says, Accessibility is fragile.
As I'm getting some "flashing" due to focus switching I'd like to explore the possibility of sending the events without having to bring Logic into focus. The OSC command that opens the Logic dialog, causes Logic to "bounce" in the dock. Is there any way I can send keyboard events to this bouncing, non focused dialog, without first bringing Logic into focus? If so happy to open a new thread to discuss.
Thanks "Mighty Quinn"!
Ok, after holding my nose with C I adapted your code to discover that changing the directory within this was useless, as it reverted once the trampoline process had finished.
So I decided to simply invoke the Pharo VM directly. Due to some quirks/bus in its start up routines, it took many hours to get it to start and change the working directory.
The good news is that I am now triggering the expected Accessibility prompt. As this is asynchronous, on installation I probe the system with a dummy keystroke, which causes the "Open Accessibility Preferences" dialog. I unlock, check the app, and re lock, and then continue. The bad news is that this makes no difference - Logic is not responding to the keypresses and I'm still getting the "Sender is prohibited from synthesizing events" in the Console error.
Interestingly there's a whole bunch of messages in the Console when I'm configuring the accessibility. Some have red dots!.
I did get a prompt for Automation/Apple Events when I first ran a script. This no longer appears, so at least that is working.
There's a slight irony in your comment regarding "alternative development environments", since Apple software has its origins in Smalltalk. Please see https://www.mac-history.net/2010/03/22/apple-and-xerox-parc/2/ And your moniker triggered a tune that I recognised - good old Manfred Mann!
Anyway, got any ideas on this?
Cheers,
Stew
Hi Quinn,
Thanks for your reply and clarify my understanding regarding not needing entitlements for posting CGEvents. I think I was confusing this with AppleEvents. I do run scripts to raise windows, check if they're open, or minimised. As they work fine, can I safely assume that there are no security implications in doing this?
Back to the posting events... I came across a post of yours which is relevant:
Programmatically press "delete" or "cmd + v" in sandboxed app
https://developer.apple.com/forums/thread/708652
T1Daniel presented a sample that "//Triggers system default accessibility access pop-up". I did a simple runtime test with a few keystrokes. I don't get a pop-up as expected, and also get a "Sender is prohibited from synthesizing events" in the Console for each key down/up post.
Which leads me to the second part of your reply, where you may have hit the nail on the head! Yes, I am using a .sh script as the configured executable. The script sets the current directory to the "application" directory within Resources, and then executes the executable. This is on account of using a Pharo Smalltalk VM as the executable. Please see the script below.
Reading your On File System Permissions post:
TCC and Main Executables
TCC expects its bundled clients — apps, app extensions, and so on — to use a native main executable. That is, it expects the CFBundleExecutable property to be the name of a Mach-O executable. If your product uses a script as its main executable, you are likely to encounter TCC problems. To resolve these, switch to using a Mach-O executable.
Am I correct in thinking that this is the root cause of my problems? I guess I need to create a native main executable to implement the functionality of the script. Any suggestions as to the best way to do that?
With respect to codesigning and notarization, I do need to do this as I want to avoid a nasty user experience when opening my app for the first time. See "Can't you just right click?" https://lapcatsoftware.com/articles/unsigned.html. So going down this rabbit hole has proved a valuable learning experience!
Thanks for your help!
Stew
=============================
BASEDIR=$(cd $(dirname $0) && pwd)
cd ${BASEDIR}
cd ../
cd Resources/MyApp
exec ../../MacOS/Pharo -logLevel=4 MyApp.image
Sorry, I missed something that may be relevant.
After the notarization had succeeded, as notified by email:
Your Mac software has been notarized. You can now export this software and distribute it directly to users.
I ran:
spctl -a -vv MyApp.app
and got this:
MyApp.app: a sealed resource is missing or invalid.
Which could be another issue? What would cause this to fail, especially after the successful notification?
I also mention "exporting" - presumably this is from XCode, or is there a manual step I also need to do?
Cheers,
Stew