Вопрос

This is an issue I have been trying to fix for a while. I get an error in my header file with an app I am trying to make for iOS using the AudioToolbox framework. Here is the code:

    #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 {






    CFBundleRef mainBundle = CFBundleGetMainBundle();
    CFURLRef soundFileURLRef;
    soundFileURLRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef) @"CString",         CFSTR ("caf"), NULL);
UInt32 soundID;
AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID);
AudioServicesPlaySystemSound(soundID);


    }


    @end

Also, the sound file is in the Supporting Files folder.

Это было полезно?

Решение

Ahhh, I see the problem.

You put your function declarations into the .h (or header) file, which is your "@interface" while the actual code you'll put into your .m file, which has the keyword "@implementation".

It looks like you simply have your code in the wrong place.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top