Wednesday, 15 May 2013

iphone - Errors while trying to play sounds with AudioToolbox in Xcode 4.6 -



iphone - Errors while trying to play sounds with AudioToolbox in Xcode 4.6 -

this issue have been trying prepare while. error in header file app trying create ios using audiotoolbox framework. here 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, sound file in supporting files folder.

ahhh, see problem.

you set function declarations .h (or header) file, "@interface" while actual code you'll set .m file, has keyword "@implementation".

it looks have code in wrong place.

iphone ios objective-c audio audiotoolbox

No comments:

Post a Comment