Reputation: 5074
I'd like to share data between objective-c compiled process and terminal. both running by the same user.
From the objC code I wrote some value under domain a.b.c
:
NSUserDefaults *defaults = [[NSUserDefaults alloc] initWithSuiteName:@"a.b.c"];
[defaults setObject:@"fffff" forKey:@"bbbbb"];
[defaults synchronize];
This process is in fact installer plugin that runs from installer.app and has the following entitlements (no sandbox) :
codesign -d --entitlements :- /System/Library/CoreServices/Installer.app
-->
Executable=/System/Library/CoreServices/Installer.app/Contents/MacOS/Installer
<?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.private.tcc.allow-prompting</key>
<array>
<string>kTCCServiceAll</string>
</array>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
</dict>
</plist>
And expected this value to be visible from the terminal using defaults read
. But unfortunately, it doesn't shown up even though both processes are running under the same user.
Here's the output from terminal :
defaults read a.b.c
2020-09-15 14:56:58.245 defaults[23380:360050]
Domain a.b.c does not exist
Any Idea what I'm missing here ? Thanks.
Upvotes: 3
Views: 135
Reputation: 31
I am a novice, I don't know what you mean by "processes".
(Perhaps two programs, Xcode executes one, terminal executes one).
But I know that "NSUserdefaults" stores data in a sandbox.
There is no sandbox for terminal programs, and the sandbox for each program is separate.
Upvotes: 1