AudioFileSetProperty returning 'kAudioFileUnsupportedPropertyError (pty?)'

I’m having difficulties writing a audio file’s metadata:

AudioFileID fileID = nil;
AudioFileOpenURL((__bridge CFURLRef) url, kAudioFileReadWritePermission, 0, &fileID );
CFDictionaryRef piDict = nil;
UInt32 piDataSize   = sizeof(piDict);   
AudioFileGetProperty( fileID, kAudioFilePropertyInfoDictionary, &piDataSize, &piDict );
NSLog(@"%@", (__bridge NSDictionary *)piDict);

NSMutableDictionary *dict = (__bridge NSMutableDictionary*)piDict;
[dict setObject:@"NEW ALBUM NAME" forKey:@"album"];
piDict = (__bridge CFDictionaryRef)dict;
piDataSize = sizeof(dict);
OSStatus status = AudioFileSetProperty(fileID, kAudioFilePropertyInfoDictionary, piDataSize, &piDict);

The NSLog on line #6 gives me a nice dictionary with ID3 information.
But when I want to alter (for instance the album name, line #9) I get an OSStatus ‘pty?’ in return.

  • Playing Raw pcm audio data coming from NSStream
  • AVAudioPlayer - must you create a property for it to work? (Xcode)
  • Sound not playing with AVAudioPlayer
  • Converting .m4a file to .aiff using AudioConverter Swift
  • Audio Not Recording in AVCaptureSession
  • Low recording volume in combination with AVAudioSessionCategoryPlayAndRecord
  • Anyone who can give me pointers on what I’m doing wrong.
    Or maybe even a better / simpler / quicker way to edit ID3 tags / metadata for audio files.

    Solutions Collect From Internet About “AudioFileSetProperty returning 'kAudioFileUnsupportedPropertyError (pty?)'”

    Doing almost the same thing here. You can check the OSStatus error with the following code.

    NSError *error = [NSError errorWithDomain:NSOSStatusErrorDomain code:status userInfo:nil];
    NSLog(@"Error: %@", [error description]);

    And what I got is:

    Error: Error Domain=NSOSStatusErrorDomain Code=1886681407 “The operation couldn’t be completed. (OSStatus error 1886681407.)”

    Could it be that iOS just doesn’t allow you to modify kAudioFilePropertyInfoDictionary?


    I just ported idlib3 to iOS and you can use it to modify the ID3 tag. An example project is also included. Check it here