无法使用iTunes Scripting Bridge和Sandboxing搜索音乐 [英] Can't search music using iTunes Scripting Bridge and Sandboxing

查看:213
本文介绍了无法使用iTunes Scripting Bridge和Sandboxing搜索音乐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用iTunes Scripting Bridge在iTunes中搜索用户的音乐。不幸的是,当我启用App Sandbox并使用以下方法从iTunes.h:

 (iTunesTrack *)searchFor: *)for_ only:(iTunesESrA)only; 

它只返回nil。但如果我禁用应用程序沙箱,它的工作完全正常。我似乎不知道什么权利,我需要包括在我的权利文件,使其正常工作。任何想法?



我的代码:

  SBElementArray * iTunesSources = self.iTunes源]; 
iTunesSource * library;
for(iTunesSource * thisSource in iTunesSources){
if([thisSource kind] == iTunesESrcLibrary){
library = thisSource;
break;
}
}
SBElementArray * libraryPlaylists = [library libraryPlaylists];
iTunesLibraryPlaylist * libraryPlaylist = [libraryPlaylists objectAtIndex:0];

SBElementArray * searchTracks =(SBElementArray *)[li​​braryPlaylist searchFor:searchTerm only:iTunesESrAA11];

我的App.entitlements文件:

 <?xml version =1.0encoding =UTF-8?> 
<!DOCTYPE plist PUBLIC - // Apple // DTD PLIST 1.0 // ENhttp://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.scripting-targets< / key>
< dict>
< key> com.apple.iTunes< / key>
< array>
< string> com.apple.iTunes.library.read-write< / string>
< string> com.apple.iTunes.playback< / string>
< string> com.apple.iTunes.playerInfo< / string>
< / array>
< / dict>
< / dict>

解决方案>

查看控制台并检查记录了哪种类型的沙箱违规;然后添加适当的权利。



如果是因为它无权向此进程发送AppleEvent。将此添加到授权文件:

 < key> com.apple.security.temporary-exception.apple-events< key> < array> < key> com.apple.iTunes< / key> < / array> 


I am using iTunes Scripting Bridge to search through the user's music in iTunes. Unfortunately, when I have App Sandbox enabled and use the following method from iTunes.h:

(iTunesTrack *) searchFor:(NSString *)for_ only:(iTunesESrA)only; 

It only returns nil. But if I disable App Sandboxing, it works perfectly fine. I can't seem to figure out what entitlements I need to include in my entitlement file to have this working correctly. Any ideas?

My code:

SBElementArray *iTunesSources = [self.iTunes sources];
iTunesSource *library;
for (iTunesSource *thisSource in iTunesSources) {
    if ([thisSource kind] == iTunesESrcLibrary) {
        library = thisSource;
        break;
    }
}
SBElementArray *libraryPlaylists = [library libraryPlaylists];
iTunesLibraryPlaylist *libraryPlaylist = [libraryPlaylists objectAtIndex:0];

SBElementArray* searchTracks = (SBElementArray *)[libraryPlaylist searchFor:searchTerm only:iTunesESrAAll];

My App.entitlements file:

<?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.scripting-targets</key>
    <dict>
        <key>com.apple.iTunes</key>
        <array>
            <string>com.apple.iTunes.library.read-write</string>
            <string>com.apple.iTunes.playback</string>
            <string>com.apple.iTunes.playerInfo</string>
        </array>
    </dict>
</dict>

解决方案

Look into Console and check what kind of sandbox violations are logged; then add the appropriate entitlements.

If it is "because it is not entitled to send an AppleEvent to this process." add this to the entitlement file:

<key>com.apple.security.temporary-exception.apple-events</key> <array> <key>com.apple.iTunes</key> </array>

这篇关于无法使用iTunes Scripting Bridge和Sandboxing搜索音乐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆