Search code examples
iosmacospermissionsmediasandbox

Specific constraints of iOS sandboxing


I would like read access to the files in the iPhones music directory:

~/Media/iTunes_Control/Music/F**/*.{M4A,MP3}

1) I can't seem to figure out from the docs whether iOS apps are sandboxed such that I would or would not have this permission.

2) Is it necessary to ask for read or write permissions to directories outside the iOS App sandbox ? Only write permissions ? How does one do this, or is it just up to the discretion of the team that reviews the App for app store release ?

3) I have found a lot of information in the apple docs on sandboxing of OS X apps but not of iOS apps. Is there a similar sandboxing/entitlements process for iOS as for OS X apps ? Any useful links I should read ?

Update: as accepted answer says below, 1,2, and 3 are impossible, however it is possible to obtain a copy of a file in the media library, which is in some sense equivalent to having read access to the original - because of course the digital information is identical. This question contains code that does that: Application crashed while importing songs from Ipod library in Iphone for iOs 5.0


Solution

    1. You will not have permission to read/write outside your application.
    2. You will not have permission to read/write outside your application.
    3. You will not have permission to read/write outside your application.

    You can use the Media Player framework to access information about the user's library, but nothing using the filesystem.