Search code examples
iphoneobjective-cmp3itunes

Saving mp3 through application so that its visible in itunes or music player


How can I save a MP3 file that I have just created in the phone memory so that it is discoverable in the music player of the phone and also visible when connected to itunes? Is it possible to do so? Or does everything will alwaz b stored in the application sandbox?


Solution

  • I'm not sure if you'll be able to just add it to the user's music collection programatically. At the very least, you can save it to the Documents directory which the user has access to from iTunes:

    NSString *documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
    

    Then you would have to set UIFileSharingEnabled to true in the project's .plist to give the user access to the Documents directory for your app. This setting allows the users to add files to Documents directory as well.

    Then they'd have to manually add the files to their collection.