Каркас AudioUnit не найден - PullRequest
1 голос
/ 24 июня 2011

Я реализую приложение на основе аудио, в котором мне нужно проигрывать как аудио приложения, так и ipod auido.Когда я пытаюсь запустить свое приложение, я получаю сообщение об ошибке:

ld: framework not found AudioUnit
collect2: ld returned 1 exit status
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 failed with exit code 1

мой код контроллера представления выглядит следующим образом:

.h файл:

 #import <UIKit/UIKit.h>
 #import <MediaPlayer/MediaPlayer.h>
 #import <AudioToolbox/AudioToolbox.h>
 #import <AVFoundation/AVFoundation.h>


 @interface AudioViewController : UIViewController     <AVAudioPlayerDelegate,MPMediaPickerControllerDelegate>
{
     UIButton *musicButton;
     UIButton *soundButton;
     AVAudioPlayer *audioPlayer;
     MPMusicPlayerController *musicPlayerController;
}
@property (nonatomic, retain)  UIButton *musicButton;
@property (nonatomic, retain)  UIButton *soundButton;
@property (nonatomic, retain) MPMusicPlayerController *musicPlayerController;

- (void)musicAction;
- (void)soundAction;

@end

.m файл:

- (id)init {
    if ((self = [super init])) 
   {
         // Custom initialization
       }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];


    musicButton=[[UIButton alloc]initWithFrame:CGRectMake(10,250 ,100, 40)];
    musicButton.backgroundColor=[UIColor blueColor];
    [musicButton setTitle:@"Next" forState:UIControlStateNormal];
    [musicButton addTarget:self action:@selector(musicAction)   forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:musicButton];
    [musicButton release];

    soundButton=[[UIButton alloc]initWithFrame:CGRectMake(210,250 ,100, 40)];
    soundButton.backgroundColor=[UIColor blueColor];
    [soundButton setTitle:@"Pre" forState:UIControlStateNormal];
    [soundButton addTarget:self action:@selector(soundAction) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:soundButton];
    [soundButton release];

    //Setup our Audio Session
    OSStatus status = AudioSessionInitialize(NULL, NULL, NULL, NULL);    
    //We want our audio to play if the screen is locked or the mute switch is on
    UInt32 sessionCategory = kAudioSessionCategory_MediaPlayback;
    status = AudioSessionSetProperty (kAudioSessionProperty_AudioCategory, sizeof (sessionCategory), &sessionCategory);
    //We want our audio to mix with other app's audio
    UInt32 shouldMix = true;
    status = AudioSessionSetProperty (kAudioSessionProperty_OverrideCategoryMixWithOthers, sizeof (shouldMix), &shouldMix);
    //Enable "ducking" of the iPod volume level while our sounds are playing
    UInt32 shouldDuck = true;
    AudioSessionSetProperty(kAudioSessionProperty_OtherMixableAudioShouldDuck, sizeof(shouldDuck), &shouldDuck);
    //Activate our audio session
    AudioSessionSetActive(YES);

    //Setup the Music Player to access the iPod music library
    self.musicPlayerController = [MPMusicPlayerController applicationMusicPlayer];
    [self.musicPlayerController setShuffleMode: MPMusicShuffleModeSongs];
    [self.musicPlayerController setRepeatMode: MPMusicRepeatModeNone];
    [self.musicPlayerController setQueueWithQuery:[MPMediaQuery songsQuery]];

    //Setup a AVAudioPlayer sound to overlay against the Music Player audio
    NSURL *soundURL = [NSURL URLWithString:[[NSBundle mainBundle] pathForResource:@"overlay" ofType:@"mp3"]];
    NSError *error = nil;
    audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:soundURL error: &error];
    if (!audioPlayer)
    {
        NSLog(@"Could not create audio effect player: %@", [error localizedDescription]);
    }
    [audioPlayer prepareToPlay];
}



- (void)musicAction
{
    if (self.musicPlayerController.playbackState == MPMusicPlaybackStatePlaying)
    {
        [self.musicPlayerController pause];
    }
    else if (self.musicPlayerController.playbackState == MPMusicPlaybackStateStopped
         || self.musicPlayerController.playbackState == MPMusicPlaybackStatePaused)
    {
        [self.musicPlayerController play];
    }
}
- (void)soundAction
{
    if (audioPlayer.playing)
    {
        [audioPlayer pause];
    }
    else
    {
        [audioPlayer play];
    }

}
- (void)dealloc
{
    [super dealloc];
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];

    // Release any cached data, images, etc that aren't in use.
}



- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

@end

Я использую FrameWorks,

1. AuidoUnit.framework.
2. AVFoundation.framework.
3. MediaPlayer.framework.
4. UIKit.framework.
5. Foundation.framework.
6. CoreGraphics.framework.
7. CoreData.framework.

Ребята, пожалуйста, посмотрите на это и дайте мне знать, что мне не хватает.

Заранее спасибо, Чандра.

Ответы [ 2 ]

3 голосов
/ 27 июня 2011

Попробуйте добавить CoreAudio.framework и AudioToolbox.framework в список фреймворков.

А также удалить AudioUnit.framework

0 голосов
/ 23 апреля 2013

В моем случае, добавив Accelerate.framework, помимо AudioToolbox.framework и CoreAudio.framework, здание удалось. Вы также можете найти это полезным.

...