CTFontManagerCreateFontRequestRunLoopSource does not receive events in macOS 27

CTFontManagerCreateFontRequestRunLoopSource does not receive any font requests on macOS 27, since beta 5. This API worked fine until macOS 27 beta 4, including previous macOS releases.

It looks like this is caused by the App Sandbox. When the com.apple.security.app-sandbox entitlement is disabled the font request source does receive events.

Report including sample project: FB24764122

let source = CTFontManagerCreateFontRequestRunLoopSource(0, { (dict, pid) in /* does not receive events when sandboxed */ }
CFRunLoopAddSource(CFRunLoopGetCurrent(), source, .defaultMode)

Is this a deliberate change or is this a bug in macOS 27? Is there an entitlement that can be set to enable the API in sandboxed apps?

My application is distributed on the Mac App Store and as standalone app. Both are properly sandboxed for added security. Disabling the App Sandbox for this specific API would be very undesirable as users will lose all Sandbox benefits.

You attached a sysdiagnose log to your bug but it looks like that log was from macOS 15.7.9. Please reproduce the problem on macOS 27, immediately grab a sysdiagnose log on that Mac, attach it to your bug, and then reply here when you’re done.

ps I have lots of bug reporting hints and tips in Bug Reporting: How and Why?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Thanks for looking into it! I've ran the sample app a few times and added the sysdiagnose log generated by the Feedback Assistant.

PS. the "File effective bug reports" link in your Bug Reporting tips topic seems to redirect to an unrelated page. If I did it incorrectly or you need more info/details please let me know :)

the "File effective bug reports" link in your Bug Reporting tips topic seems to redirect to an unrelated page.

Yeah, that’s weird. The link used to work. I’ve made a note to fix this. Thanks for the heads up.

I've ran the sample app a few times and added the sysdiagnose log generated by the Feedback Assistant.

Cool.

I’m not seeing the info I expect to see in those logs, so lemme ask you a question. The test project you attached to the bug report builds an app called FontRequest with a bundle ID of com.example.FontRequest. Is that the same sample app you ran before triggering the sysdiagnose log?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Is that the same sample app you ran before triggering the sysdiagnose log?

Yes.

I repeated the steps on a different Mac and added it to the report. Ran the sample app a few times, then added "Device Diagnostics" in Feedback Assistant. Then it's gathering info, I'm not sure if I should launch the app during gathering or before that, but I did both in this case.

The system_logs.logarchive seem to include entries for com.example.FontRequest

If I did it incorrectly please let me know.

I'm currently investigating alternatives in case the API will not be available anymore when sandboxed. I've read some of your posts about XPC, so perhaps you can give your opinion on the following workaround:

Standalone distributed app:

  • Keep app sandboxed
  • Add non-sandboxed bundled XPC Service
  • Run the API in XPC Service and communicate with app when necessary

Mac App Store app:

  • everything must be sandboxed so cannot bundle XPC Service
  • Provide external non-sandboxed Helper app with same group container as main app
  • Communicate with external Helper app via XPC and group container

Side question: should I use the iOS-style group identifier for this (according to https://developer.apple.com/forums/thread/721701) or should I use the macOS style Team ID prefix for the group container to communicate with the external XPC helper app?

That function's been deprecated since 10.6. This is why people shouldn't sit on deprecated functions. Maybe you could have come up with a workaround, or filed an enhancement request for an alternative.

You can include a non-sandboxed XPC, but the entire function could go away. And your Mac App Store route is a whole different can-o-worms. It's one thing to have a technical barrier, now you're talking policy, user experience, and App Review barriers. That's bad.

What does this function actually do for you?

CTFontManagerCreateFontRequestRunLoopSource does not receive events in macOS 27
 
 
Q