Macos 沙盒模式下iTunesTrack位置为零?
我正在沙盒一个osx应用程序,它使用脚本桥访问iTunesMacos 沙盒模式下iTunesTrack位置为零?,macos,sandbox,appstore-sandbox,scripting-bridge,Macos,Sandbox,Appstore Sandbox,Scripting Bridge,我正在沙盒一个osx应用程序,它使用脚本桥访问iTunes for(iTunesFileTrack* track in fileTracks) { //url is nill in sandbox mode but good value in non sandbox mode NSURL* url = [track location]; NSString* sourceFile = [[
for(iTunesFileTrack* track in fileTracks)
{
//url is nill in sandbox mode but good value in non sandbox mode
NSURL* url = [track location];
NSString* sourceFile = [[track location] path];
if(sourceFile == nil)
{
NSLog(@"Sourcefile for the track %@ was nil", track);
continue;
}
}
如果返回nil,我将使用以下权利
<?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.security.app-sandbox</key>
<true/>
<key>com.apple.security.assets.movies.read-write</key>
<true/>
<key>com.apple.security.assets.music.read-write</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
<key>com.apple.security.network.server</key>
<true/>
<key>com.apple.security.scripting-targets</key>
<dict>
<key>com.apple.iTunes</key>
<array>
<string>com.apple.iTunes.device</string>
<string>com.apple.iTunes.library.read</string>
<string>com.apple.iTunes.library.read-write</string>
<string>com.apple.iTunes.playback</string>
<string>com.apple.iTunes.podcast</string>
<string>com.apple.iTunes.user-interface</string>
</array>
</dict>
<key>com.apple.security.temporary-exception.apple-events:before:10.8</key>
<array>
<string>com.apple.itunes</string>
</array>
</dict>
</plist>
它在10.7中运行良好,位置返回正常,但在10.8和10.9中,由于脚本目标权限处于活动状态,我可以迭代库,但轨迹的位置为零,这是为什么?如果我只是使用临时异常并删除part:before10.8,那么它就可以工作了
但是,由于苹果公司建议我们在10.8+版本中使用脚本目标,而不是临时例外授权,所以我使用的是推荐的。非常感谢您的帮助。我通过为iTunes添加一个临时例外来解决这个问题,如中所示
com.apple.security.temporary-exception.apple-events
com.apple.iTunes
Please vote的可能重复项以重复项结束问题,而不是重复Stack Overflow上其他帖子的答案。
iTunes[1592]: AppleEvents/sandbox: Returning errAEPrivilegeError/-10004 and denying dispatch of event core/getd from process 'TestiTunesAccess'/0x0-0x4d04d, pid=1789, because it is not entitled to send an AppleEvent to this process.
<key>com.apple.security.temporary-exception.apple-events</key>
<array>
<string>com.apple.iTunes</string>
</array>