私のアプリにスケジューリングを追加する必要があります。私のアプリが指定された日時に自動的に起動するようにします。私はScheduling Timed Jobsを参照してそれを行った。私はスケジューリングのplistファイルを/Users/username/Library/LaunchAgents
に入れました。非サンドボックスアプリではうまく動作しますが、サンドボックスアプリでは機能しません。スケジューリングファイルをパス/Users/username/Library/LaunchAgents
に追加できません。それは私にエラーが発生しますSandboxedアプリでスケジューリングを追加するには?
Error Domain=NSCocoaErrorDomain Code=513 "“com.sample.schedule.plist” couldn’t be copied because you don’t have permission to access “LaunchAgents”." UserInfo=0x100114f10 {NSSourceFilePathErrorKey=/Users/username/Library/Developer/Xcode/DerivedData/SchedulingInSandbox-cernhnigkuqhehbndryxlekpiiiu/Build/Products/Debug/SchedulingInSandbox.app/Contents/Resources/com.sample.schedule.plist, NSUserStringVariant=(
Copy
), NSDestinationFilePath=/Users/username/Library/LaunchAgents/com.sample.schedule.plist, NSFilePath=/Users/username/Library/Developer/Xcode/DerivedData/SchedulingInSandbox-cernhnigkuqhehbndryxlekpiiiu/Build/Products/Debug/SchedulingInSandbox.app/Contents/Resources/com.sample.schedule.plist, NSUnderlyingError=0x1001132d0 "The operation couldn’t be completed. Operation not permitted"}
私はLaunchAgentsパスもエンタイトルメントに追加しました。
<key>com.apple.security.temporary-exception.files.home-relative-path.read-write</key>
<array>
<string>/Library/LaunchAgents/</string>
</array>
しかし、まだ私はLaunchAgentsディレクトリにscheculing plistを追加できません。私が正しくやっているのか、サンドボックスアプリでスケジューリングをするための別の方法があるのか。
EDIT 1:
私は手動で/Library/Containers/LaunchAgents
にフォルダを作成し、そこのplistを置けば、私はこのエラーを取得しています:
Could not open job overrides database at: /private/var/db/launchd.db/com.apple.launchd.peruser.501/overrides.plist: 1: Operation not permitted
launch_msg(): Socket is not connected
ただし、LaunchAgentsディレクトリはコンテナにありません。自分で作成する必要があるかどうかあなたはサンドボックス化されたら – Aravindhan
、その後のほとんどhttps://developer.apple.com/library/mac/#documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html([パス発見のAPIを使用すると、適切な相対パスを与える必要があります] )。たとえば、[NSHomeDirectory](https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Miscellaneous/Foundation_Functions/Reference/reference.html#//apple_ref/c/func/)を使用する場合は、 NSHomeDirectory)は、アプリケーションのコンテナに配置します。それでは、コピーしたりplistを作ったりするだけです。 – macshome
私はディレクトリを作成しplistを入れました。更新された質問をご覧ください。 – Aravindhan