3

i am trying to make some sense of an error code being returned when setting the scheduledFileID to an AUFilePlayer. Previously when developing for OSX i used

const char* GetMacOSStatusErrorString(OSStatus err);

const char* GetMacOSStatusCommentString(OSStatus err);

but they are declared in Carbon CarbonCore/Debugging.h so they are not available to me in iOS . Does anyone know of an equivalent way of doing this on iOS ?

FredrikJansson
  • 135
  • 2
  • 10
  • Here is one brilliant comment on it: http://stackoverflow.com/questions/12079144/osstatus-nsosstatuserrordomain – Eric Brotto Oct 14 '12 at 10:34

1 Answers1

3

I'm using this kind of code to get understandable error codes:

OSStatus ScheduledFilesIDSError = AudioUnitSetProperty(auFilePlayerUnit,kAudioUnitProperty_ScheduledFileIDs,kAudioUnitScope_Global, 0, &filePlayerFile, sizeof(filePlayerFile));
if (ScheduledFilesIDSError == noErr)
{
}
else
{   
    printf("AudioUnitSetProperty[kAudioUnitProperty_ScheduledFileIDs] failed, Error Code:%ld,\n", ScheduledFilesIDSError);
    NSError *error = [NSError errorWithDomain:NSOSStatusErrorDomain code:ScheduledFilesIDSError userInfo:nil];
    NSLog(@"Error: %@", [error description]);
}

the resulting log in my case is like :

Error: Error Domain=NSOSStatusErrorDomain Code=-50 "The operation couldn’t be completed. (OSStatus error -50.)"
Error: AudioUnitSetProperty[kAudioUnitProperty_ScheduledFileRegion] failed (-50)
Unai Vivi
  • 3,073
  • 3
  • 30
  • 46
Stone Alessandro
  • 359
  • 3
  • 14