2013-05-21 5 views
6

私のアプリにスケジューリングを追加する必要があります。私のアプリが指定された日時に自動的に起動するようにします。私は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 

答えて

1

/Users/<username>/Library/Containers/<my app identifier>/Data/Library/LaunchAgents/<my app identifier>.<somename>.plist 

にあなたの仕事のplistを入れてみてくださいこれは、サンドボックス化されたアプリのデータコンテナです。

は私のMac上で見て、私は、FaceTimeのが2つのスケジュールされたジョブのプレースメントリストを持っていることをあなたはおそらく一例として使用することができます参照してください。

+0

ただし、LaunchAgentsディレクトリはコンテナにありません。自分で作成する必要があるかどうかあなたはサンドボックス化されたら – Aravindhan

+0

、その後のほとんど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

+0

私はディレクトリを作成しplistを入れました。更新された質問をご覧ください。 – Aravindhan

関連する問題