ios - Apple Mach-O Linker Error for "_AudioServicesCreateSystemSound" and 1 other -
i'm relatively new ios development , i've come across error. adding sound project , i've imported audiotoolbox.framework when try build project gives me above error.it gives me "apple mach-o linker error _audioservicesdisposesystemsoundid" , "linker command failed exit code 1 (use -v see invocation".
this code:
currentlocationviewcontroller.m
@implementation currentlocationviewcontroller { cllocationmanager *locationmanager; cllocation *location; bool updatinglocation; nserror *lastlocationerror; clgeocoder *geocoder; clplacemark *placemark; bool performingreversegeocoding; nserror *lastgeocodingerror; uiactivityindicatorview *spinner; systemsoundid soundid; }
and:
- (void)viewdidload { [super viewdidload]; [self updatelabels]; [self configuregetbutton]; [self loadsoundeffect]; }
also:
lastgeocodingerror = error; if (error == nil && [placemarks count] > 0) { if (placemark == nil) { nslog(@"first time!"); [self playsoundeffect]; } placemark = [placemarks lastobject]; } else { placemark = nil; }
and finally:
#pragma mark - sound effect - (void)loadsoundeffect { nsstring *path = [[nsbundle mainbundle] pathforresource:@"sound.caf" oftype:nil]; nsurl *fileurl = [nsurl fileurlwithpath:path isdirectory:no]; if (fileurl == nil) { nslog(@"nsurl nil file file path: %@", path); return; } osstatus error = audioservicescreatesystemsound((__bridge cfurlref)fileurl,&soundid); if (error != kaudioservicesnoerror) { nslog(@"error code %ld loading sound @ path: %@", error, path); return; } } - (void)unloadsoundeffect { audiosystemdisposesystemsoundid(soundid); soundid = 0; } - (void)playsoundeffect { audioservicesplaysystemsound(soundid); } @end
on lines when call audiosystem/services there yellow warning saying "implicit declaration of function '(what on line)' invalid in c99"
any appreciated! thanks!
change audioservicescreatesystemsound
audioservicescreatesystemsoundid
Comments
Post a Comment