2

I am implementing Music Player application in iOS platform. Here I am storing and retrieving the media contents using Documents directory. So I can't able to access the 'Documents Directory' when iPhone is getting locked with passcode. I referred Apple developer library, they said the Encryption & Decryption is comes under the accessing the file contents from documents directory. So if device is getting locked the Decryption key is Destroyed. Here I have attached the Screen shot of Problem Description. I was stuck with this problem last 2 months. Pls give me any other ways to access the Documents directory at locked state. Not Only Media , Any other content*.

Thanks in Advance.

Screen Shot

Apple Developer Site: https://developer.apple.com/library/mac/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html

iTag
  • 409
  • 3
  • 19
  • 1
    If apple said it is not possible then it is not possible. (without jailbreak/break the security system) – Bryan Chen Apr 09 '14 at 04:58
  • But Other Music Applications, how does support. @BryanChen – iTag Apr 09 '14 at 05:13
  • Have you set the correct UIBackgroundMode for audio in your info.plist to allow your device to run as a background task? – Sean Kladek Apr 09 '14 at 05:32
  • Yeah. this link will give you more detailed. http://stackoverflow.com/questions/21875213/avaudioplayer-is-not-playing-in-background-when-iphone-is-locked pls look at this. – iTag Apr 09 '14 at 05:40

1 Answers1

1

You need to specify the file protection level as an option when you write your files. Example:

[someData writeToFile:filePath options:NSDataWritingFileProtectionNone error:&error];

In this, someData is an NSData representation of the data you want to write to disk, filePath is the string path where you want to save the file.

Read the documentation on NSDataWritingOptions in the NSData Class Reference for more encryption options.

Sean Kladek
  • 4,396
  • 1
  • 23
  • 29
  • Thanks for your help.Its working fine for first file. For ex. First song is playing perfectly. but the next Song is not playing Automatically.If I unlock the device is playing. Can you help me? @skladek – iTag Apr 10 '14 at 08:02
  • Is the first file playing before the device locks? How have you set up the queue for songs to load and play the next song? – Sean Kladek Apr 10 '14 at 14:51
  • Yeah. I am not used AVQueuePlayer. Just I used Array of file paths and just replacing the new path after finished first song. That Audiodidfinishloading - delegate also calling. but not working? can you tell me? – iTag Apr 10 '14 at 21:40