I found my pkg installer while writing to Data Container in App Sandbox since macOS 14 Sonoma.
What is wrong with my installer?
My pkg will install file to App Sandbox Container.
(Destination Path: "~/Library/Containers/net.mtgto.inputmethod.macSKK/Data/Documents/Dictionaries/SKK-JISYO.L")
But I found Installer always asks that
“Installer” would like to access data from other apps.
Keeping app data separate makes it easier to manage your privacy and security.
Click "Don't Allow" button and Installer.app says "The installation failed".
This dialog is not shown macOS 13 Ventura. So it seems to relate App Sandbox changes in macOS 14:
https://developer.apple.com/documentation/security/app_sandbox/accessing_files_from_the_macos_app_sandbox
Is there a way to write to App Sandbox Container from pkg?
For detail: https://github.com/mtgto/macSKK/issues/54
Also you can download installer from https://github.com/mtgto/macSKK/releases/tag/0.9.1
(pkg file is exists in macSKK-0.9.1.dmg)
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I noticed a problem while writing a program using XPC on macOS.
When I write it in the form of a closure that receives the result of an XPC call, I can't receive it forever.
I add an XPC target in Xcode, the sample code is used in the pass closure format, but can't I use closure passing with XPC?
My Environment:
Xcode 15.3
macOS 14.4.1
caller (closure version)
struct ContentView: View {
@State var callbackResult: String = "Waiting…"
var body: some View {
Form {
Section("Run XPC Call with no argument and no return value using callback") {
Button("Run…") {
callbackResult = "Running…"
let service = NSXPCConnection(serviceName: "net.mtgto.example-nsxpc-throws-error.ExampleXpc")
service.remoteObjectInterface = NSXPCInterface(with: ExampleXpcProtocol.self)
service.activate()
guard let proxy = service.remoteObjectProxy as? any ExampleXpcProtocol else { return }
defer {
service.invalidate()
}
proxy.performCallback {
callbackResult = "Done"
}
}
Text(callbackResult)
...
}
}
}
callee (closure version)
@objc protocol ExampleXpcProtocol {
func performCallback(with reply: @escaping () -> Void)
}
class ExampleXpc: NSObject, ExampleXpcProtocol {
@objc func performCallback(with reply: @escaping () -> Void) {
reply()
}
}
I found this problem can be solved by receiving asynchronous using Swift Concurrency.
caller (async version)
struct ContentView: View {
@State var callbackResult: String = "Waiting…"
var body: some View {
Form {
Section("Run XPC Call with no argument and no return value using callback") {
Button("Run…") {
simpleAsyncResult = "Running…"
Task {
let service = NSXPCConnection(serviceName: "net.mtgto.example-nsxpc-throws-error.ExampleXpc")
service.remoteObjectInterface = NSXPCInterface(with: ExampleXpcProtocol.self)
service.activate()
guard let proxy = service.remoteObjectProxy as? any ExampleXpcProtocol else { return }
defer {
service.invalidate()
}
await proxy.performNothingAsync()
simpleAsyncResult = "DONE"
}
Text(simpleAsyncResult)
...
}
}
}
callee (async version)
@objc protocol ExampleXpcProtocol {
func performNothingAsync() async
}
class ExampleXpc: NSObject, ExampleXpcProtocol {
@objc func performNothingAsync() async {}
}
To simplify matters, I write source code that omits the arguments and return value, but it is not also invoked by using callback style.
All sample codes are available in
https://github.com/mtgto/example-nsxpc-throws-error
I made a macOS application using Swift Package and distributed it in dmg format through Apple Notary service. However, we received a report from a user that it can be launched from a disk image mounted from dmg, but when copied to /Applications, the app is broken and does not start.
I looked into why this happened, I noticed that the codesign command returned different results when copying the application bundle and /Applications on the volume mounted dmg with Finder.
Mounted dmg: OK
❯ codesign --verify --deep --verbose /Volumes/azoo-key-skkserv/azoo-key-skkserv.app
/Volumes/azoo-key-skkserv/azoo-key-skkserv.app: valid on disk
/Volumes/azoo-key-skkserv/azoo-key-skkserv.app: satisfies its Designated Requirement
Copied by Finder: Bad
codesign reports that there are 148 added/missing files.
❯ codesign --verify --deep --verbose /Applications/azoo-key-skkserv.app
/Applications/azoo-key-skkserv.app: a sealed resource is missing or invalid
file added: /Applications/azoo-key-skkserv.app/Contents/Resources/AzooKeyKanakanjiConverter_KanaKanjiConverterModuleWithDefaultDictionary.bundle/Contents/Resources/Dictionary/louds/グ1.loudstxt3
(skip...)
file missing: /Applications/azoo-key-skkserv.app/Contents/Resources/AzooKeyKanakanjiConverter_KanaKanjiConverterModuleWithDefaultDictionary.bundle/Contents/Resources/Dictionary/louds/グ1.loudstxt3
(skip...)
Copied by ditto: OK
❯ ditto /Volumes/azoo-key-skkserv/azoo-key-skkserv.app /Applications/azoo-key-skkserv.app
❯ codesign --verify --deep --verbose /Applications/azoo-key-skkserv.app
/Applications/azoo-key-skkserv.app: valid on disk
/Applications/azoo-key-skkserv.app: satisfies its Designated Requirement
I made a simple macOS application to explain this problem in an easy-to-understand way. You can download dmg in github releases, mount dmg, copy it in the Finder, and check if there is a problem by running the codesign command.
https://github.com/mtgto/example-utf8-mac-notarization
As a result, I learned the following two things.
Occurs only with resources with file names whose values change due to NFC/NFD normalization
No problems occur with the resources of the application itself. Generated by the Swift Package resources that the application depends on
I think this is a problem with Finder or Gatekeeper.
Topic:
Code Signing
SubTopic:
General