0

私はこの問題の解決策を見つけようとしています。サウンド ファイルを使用して AudioToolbox フレームワークを正しくセットアップしましたが、エラーは発生しませんでした。コンパイルして正常に実行されますが、ボタンを押してサウンドを再生しようとすると、 というファイルに醜い緑色のハイライトが表示されますmain.mmain.mサウンドを再生しようとした後に表示されたファイルは次のとおりです。

#import <UIKit/UIKit.h>
#import "AppDelegate.h"

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

ライン上ではreturn UIApplicationMain、そこにグリーンが現れます。それは言いThread 1: Signal SIGABRTます。

ここで何が問題なのですか?

これが私の ViewController .m および .h ファイルです。

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController
@synthesize bannerIsVisible;


-(void)bannerViewDidLoadAd:(ADBannerView *)banner {
if (!self.bannerIsVisible) {

    [UIView beginAnimations:@"animateAdBanner" context:NULL];
    banner.frame = CGRectOffset(banner.frame, 0, -50.0f);
    [UIView commitAnimations];
    self.bannerIsVisible = YES;
}
}

-(void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error {
if (self.bannerIsVisible) {
    [UIView beginAnimations:@"animateAdBannerOff" context:NULL];
    banner.frame = CGRectOffset(banner.frame, 0, 50.0f);
    [UIView commitAnimations];
    self.bannerIsVisible = NO;
 }
}

- (void)viewDidLoad
{
[super viewDidLoad];

adView = [[ADBannerView alloc] initWithFrame:CGRectZero];
adView.frame = CGRectOffset(adView.frame, 0, 460.0f);
adView.requiredContentSizeIdentifiers = [NSSet       setWithObject:ADBannerContentSizeIdentifierPortrait];
adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierPortrait;
[self.view addSubview:adView];
adView.delegate=self;
self.bannerIsVisible=NO;

}

- (void)didReceiveMemoryWarning


{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

- (IBAction)cstring:(id)sender {
CFBundleRef mainBundle = CFBundleGetMainBundle();
CFURLRef soundFileURLRef;
soundFileURLRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef) @"CString", CFSTR    ("caf"), NULL);
UInt32 soundID;
AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID);
AudioServicesPlaySystemSound(soundID);
}
@end

そして今、私の .h:

#import <iAd/iAd.h>
#import <UIKit/UIKit.h>
#import <AudioToolbox/AudioToolbox.h>
#import <iAd/ADBannerView_Deprecated.h>
#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>

@interface ViewController : UIViewController <ADBannerViewDelegate> {


ADBannerView *adView;
BOOL bannerIsVisible;

}

@property (nonatomic, assign) BOOL bannerIsVisible;


- (IBAction)cstring:(id)sender;












@end
4

1 に答える 1

0

エラーの原因を突き止める必要があります。1 つの手順を実行することも、次の 2 つの手順の少なくとも 1 つを実行することもできます。

  1. このパッチをメインにインストールして、例外をコンソールに記録します。
  2. Xcode ブレークポイント タブの下部で、「+」を押して新しいブレークポイントを追加し、例外ブレークポイントを追加するオプションを選択します。(表示されている正確な単語は忘れましたが、かなり明白です。) これにより、例外が発生したときにブレークポイントが発生します。
于 2013-02-10T14:31:54.737 に答える