OK, I've successfully changed the app group to iOS style (group.com.myorg.MyApp)... and it hasn't fixed the problem. It's working on older versions, but still failing on Sequoia.
To confirm:
- Both the main app and extension have an explicit app ID (com.myorg.MyApp and com.myorg.MyApp.EMPFileProvider, respectively).
- I have added an App Group identifier on the website for group.com.myorg.MyApp -- the website won't let me add one in the old macOS format (I understand this is normal).
- On the website, in the Identifier entry for each component, I've added group.com.myorg.MyApp to the existing App Group set. This has required me to re-generate the provisioning profiles.
- On the Profiles page, I regenerated the profiles (by choosing Edit and then Save rather than deleting and re-creating them). I downloaded and installed the new profiles.
- The resulting app works fine on a pre-Sequoia machine. But on the Sequoia one, the main app runs successfully (and can log to the Group Container), and the FileProvider also runs, but the FileProvider can not write its logs, read its prefs, or access the connecting pipe.
We still get the following errors in the Console log (filtered on "fileprovider”), which indicate that even though it’s got the appropriate application-groups entitlement, it’s not able to access the prefs or create the log files:
default 16:26:01.341453-0700 EMPFileProvider container_create_or_lookup_app_group_path_by_app_group_identifier: success
error 16:26:01.342562-0700 EMPFileProvider Couldn't read values in CFPrefsPlistSource<0x7f83db71aab0> (Domain: group.com.mydomain.MyApp, User: kCFPreferencesAnyUser, ByHost: Yes, Container: (null), Contents Need Refresh: Yes): Using kCFPreferencesAnyUser with a container is only allowed for System Containers, detaching from cfprefsd
error 16:26:01.344858-0700 cfprefsd rejecting read of { group.com.mydomain.MyApp, mikec, kCFPreferencesAnyHost, /Users/mikec/Library/Group Containers/group.com.mydomain.MyApp/Library/Preferences/group.com.mydomain.MyApp.plist, managed: 0 } from process 1791 (EMPFileProvider) because accessing preferences outside an application's container requires user-preference-read or file-read-data sandbox access
fault 16:26:01.346167-0700 EMPFileProvider Couldn't read values in CFPrefsPlistSource<0x7f83db7104d0> (Domain: group.com.mydomain.MyApp, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: Yes): accessing preferences outside an application's container requires user-preference-read or file-read-data sandbox access
error 16:26:01.347646-0700 cfprefsd rejecting read of { group.com.mydomain.MyApp, mikec, kCFPreferencesAnyHost, /Users/mikec/Library/Group Containers/group.com.mydomain.MyApp/Library/Preferences/group.com.mydomain.MyApp.plist, managed: 0 } from process 1791 (EMPFileProvider) because accessing preferences outside an application's container requires user-preference-read or file-read-data sandbox access
fault 16:26:01.347939-0700 EMPFileProvider Couldn't read values in CFPrefsPlistSource<0x7f83db7104d0> (Domain: group.com.mydomain.MyApp, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: Yes): accessing preferences outside an application's container requires user-preference-read or file-read-data sandbox access
error 16:26:01.349210-0700 kernel 1 duplicate report for System Policy: EMPFileProvider(1791) deny(1) file-read-data /Users/mikec/Library/Group Containers/group.com.mydomain.MyApp/Library/Preferences/group.com.mydomain.MyApp.plist
error 16:26:01.351654-0700 cfprefsd rejecting read of { group.com.mydomain.MyApp, mikec, kCFPreferencesAnyHost, /Users/mikec/Library/Group Containers/group.com.mydomain.MyApp/Library/Preferences/group.com.mydomain.MyApp.plist, managed: 0 } from process 1791 (EMPFileProvider) because accessing preferences outside an application's container requires user-preference-read or file-read-data sandbox access
fault 16:26:01.352056-0700 EMPFileProvider Couldn't read values in CFPrefsPlistSource<0x7f83db7104d0> (Domain: group.com.mydomain.MyApp, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: Yes): accessing preferences outside an application's container requires user-preference-read or file-read-data sandbox access
error 16:26:01.357264-0700 kernel 1 duplicate report for System Policy: EMPFileProvider(1791) deny(1) file-write-create /Users/mikec/Library/Group Containers/group.com.mydomain.MyApp/Library/Logs/cloud1791_2.log
error 16:26:01.357269-0700 kernel System Policy: EMPFileProvider(1791) deny(1) file-write-create /Users/mikec/Library/Group Containers/group.com.mydomain.MyApp/Library/Logs/cloud1791_3.log
default 16:26:01.360168-0700 EMPFileProvider Extension `/Applications/EMPSecure.app/Contents/PlugIns/EMPFileProvider.appex/Contents/MacOS/EMPFileProvider` of type: `1` launched.
For the record, here are the Entitlements in the embedded provision profile in the main app:
<key>Entitlements</key>
<dict>
<key>com.apple.security.application-groups</key>
<array>
<string>group.XXXXXXXXXX.com.mydomain.MyApp</string>
<string>group.com.mydomain.MyApp</string>
<string>XXXXXXXXXX.*</string>
</array>
<key>com.apple.application-identifier</key>
<string>XXXXXXXXXX.com.mydomain.MyApp</string>
<key>keychain-access-groups</key>
<array>
<string>XXXXXXXXXX.*</string>
</array>
<key>com.apple.developer.team-identifier</key>
<string>XXXXXXXXXX</string>
</dict>
And here are the ones in the FileProvider extension:
<key>Entitlements</key>
<dict>
<key>com.apple.developer.networking.networkextension</key>
<array>
<string>packet-tunnel-provider-systemextension</string>
<string>app-proxy-provider-systemextension</string>
<string>content-filter-provider-systemextension</string>
<string>dns-proxy-systemextension</string>
<string>dns-settings</string>
<string>relay</string>
<string>url-filter-provider</string>
<string>hotspot-provider</string>
</array>
<key>com.apple.security.application-groups</key>
<array>
<string>group.XXXXXXXXXX.com.mydomain.MyApp</string>
<string>group.com.mydomain.MyApp</string>
<string>XXXXXXXXXX.*</string>
</array>
<key>com.apple.application-identifier</key>
<string>XXXXXXXXXX.com.mydomain.MyApp.EMPFileProvider</string>
<key>keychain-access-groups</key>
<array>
<string>XXXXXXXXXX.*</string>
</array>
<key>com.apple.developer.team-identifier</key>
<string>XXXXXXXXXX</string>
</dict>
Note that there are multiple app groups present -- I didn't remove the old one in Xcode when I added the new one! Surely a failure with that one couldn't block a perfectly valid app group alongside it?
Anything else I should look for in the console logs to check which app groups the extension actually has access to?