Apple Script Bridge出现奇怪的错误-iTunes [英] Weird Error With Apple Script Bridge - iTunes

查看:48
本文介绍了Apple Script Bridge出现奇怪的错误-iTunes的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个可以控制iTunes的ObjC应用程序.我需要一种方法,该方法将返回iTunes中所有播放列表的数组.

I'm trying to create an ObjC application that will control iTunes. I need a method that will return an array of all the playlists in iTunes.

我收到了有史以来最奇怪,最无助的错误消息...首先是代码:

I'm getting the most bizarre, unhelpful error message ever... First the code:

#import "MusicControl.h"
#import "iTunes.h"

@implementation MusicControl


- (SBElementArray *) playlists {  


    // Create iTunes Object
    iTunesApplication *iTunes = [SBApplication applicationWithBundleIdentifier:@"com.apple.iTunes"];

     NSArray *sources = [iTunes sources];
     iTunesSource *librarySource = nil;

     for (iTunesSource *source in sources) {
     if ([source kind] == iTunesESrcLibrary) {
     librarySource = source;
     break;
     }
     }

     return [librarySource userPlaylists]; 
} 

@end

我不知道数组返回是否有效,因为在进行了一些调试后,我发现这是轰炸的地方是我创建 iTunes 对象的第一行,该对象被复制并粘贴来自苹果公司的网站 ...

I have no idea whether the array return is working or not because, after doing some debugging, I found that where this is bombing out is the very first line where I create the iTunes object, which was copied and pasted from Apple's website...

我得到的错误是:

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_SBApplication", referenced from:
      objc-class-ref in MusicControl.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

关于到底发生了什么的任何建议?

Any suggestion as the what the heck is going on?

推荐答案

此消息(和类似消息)表示链接器正在寻找某些特定的符号,但找不到它.您的情况是 SBApplication .

This message (and similar ones) means that the linker is looking for some specific symbol, but can't find it. In your case it is SBApplication.

如果尚未这样做,则应确保已链接到ScriptingBridge框架.

If you have not already done so, you should make sure that you have linked to the ScriptingBridge framework.

要添加框架,请单击Xco​​de左侧栏顶部的项目图标,然后选择构建阶段".如果尚未扩展与二进制库链接",请执行此操作并添加框架.

To add a framework, click on the project's icon at the top of the left hand bar in Xcode, then select Build Phases. If Link With Binary Libraries is not already expanded, do that and add the framework.

相同的过程可用于普通库(框架实际上只是库的包装,至少出于本次讨论的目的).

The same procedure can be used for plain libraries (a framework is really just a wrapper around a library, at least for the purpose of this discussion).

这篇关于Apple Script Bridge出现奇怪的错误-iTunes的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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