Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Beginning iOS5 Development.pdf
Скачиваний:
7
Добавлен:
09.05.2015
Размер:
15.6 Mб
Скачать

214

CHAPTER 7: Tab Bars and Pickers

Linking in the Audio Toolbox Framework

If you try to compile now, you’ll get a linking error. It turns out that the problem is with those functions we called to load and play sounds. Yeah, they’re not in any of the frameworks that are linked in by default. A quick command-double-click on the AudioServicesCreateSystemSoundID function takes us to the header file where it’s declared. If we scroll up to the top of that header file, we see this:

/*======================================================================= File: AudioToolbox/AudioServices.h

Contains: API for general high level audio services.

Copyright: (c) 2006 - 2008 by Apple Inc., all rights reserved.

...

This tells us that the function we’re trying to call is part of the Audio Toolbox, so we need to manually link our project to that framework.

This is pretty easy to do. In the project navigator, click the Pickers target, which should be the top icon in our list. In the edit pane that appears, find the TARGETS area and click Pickers. In the pane that appears, click the Build Phases tab. In the Build Phases tab, open the Link Binary With Libraries disclosure triangle. Notice the Add items icon, which is a plus sign (see Figure 7–23).

Figure 7–23. To add a framework to your project, select the target in the project navigator, and then select the appropriate target in the pane that appears. Finally, select the Build Phases tab and open the Link Binary With Libraries disclosure triangle. Note that the cursor is hovering over the Add items plus sign icon.

www.it-ebooks.info

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]