简体   繁体   中英

xcode 4.2 soundboard thread 1

hi i have created a Xcode soundboard but when i run it on my iPhone i get this error and not to sure how to solve it can you help ?

//
//  main.m
//  sound
//
//  Created by Paul masters on 27/04/2012.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>

#import "AppDelegate.h"

int main(int argc, char *argv[])
{
    @autoreleasepool {
        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
    }
}

the error is

return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));

thread 1: signal SIGABRT

THANKS

this is the view controller.h

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

@interface ViewController : UIViewController
- (IBAction)yooo:(id)sender;

- (IBAction)boom:(id)sender;


@end

this is the view controller.m

- (IBAction)yooo:(id)sender {

    CFBundleRef mainbundle = CFBundleGetMainBundle();
    CFURLRef soundFileUrlRef;
    soundFileUrlRef = CFBundleCopyResourceURL(mainbundle, (CFStringRef) @"tb1", CFSTR ("wav"), NULL); 
    UInt32 soundID;
    AudioServicesCreateSystemSoundID(soundFileUrlRef, &soundID);
    AudioServicesPlaySystemSound(soundID);}

- (IBAction)boom:(id)sender {


    CFBundleRef mainbundle = CFBundleGetMainBundle();
    CFURLRef soundFileUrlRef;
    soundFileUrlRef = CFBundleCopyResourceURL(mainbundle, (CFStringRef) @"ta1", CFSTR ("wav"), NULL); 
    UInt32 soundID;
    AudioServicesCreateSystemSoundID(soundFileUrlRef, &soundID);
    AudioServicesPlaySystemSound(soundID);
}


@end

this is my code with that thread 1 error!! 这是我的代码失败的图片

在此处输入图片说明

您需要做的是找到构建阶段,然后单击+并添加audio.framework ,然后尝试run and build ,一切都应该很好。

You need to set an exception breakpoint. See "Run > Stop on Objective-C exception" in Xcode 4? . If you don't have an exception breakpoint and an exception occurs, all you will see is just a SIGABRT with no stack, so you can't find out, what really happened.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM