Can i access iPod Library on simulator?

≡放荡痞女 提交于 2019-11-28 08:32:36

Yes you need to test on a device to access the media library.

JosephH

I've had some success using MPMediaLibrary / MPMediaQuery on the simulator (not playing music, but at least able to query for items) and xcode 4.6.3

I used iFunBox to copy these files from my device:

'Raw File System'/iTunes_Control/iTunes/MediaLibrary.sqlitedb
'Raw File System'/iTunes_Control/iTunes/MediaLibrary.sqlitedb-shm
'Raw File System'/iTunes_Control/iTunes/MediaLibrary.sqlitedb-wal
'Raw File System'/iTunes_Control/iTunes/Artwork

onto my mac in the folder:

"~/Library/Application Support/iPhone Simulator/6.1/Media/iTunes_Control/iTunes/"

Clarification to answer JosephH:

it even works in Xcode 6 but the files should be placed in a folder:

"~/Library/Developer/CoreSimulator/Devices/########-####-####-####-############/data/Media/iTunes_Control/iTunes"

where ########-####-####-####-############ - will be different for different versions of the simulator phone

I was trying to figure this out as well and since you basically need to use all of the answers given here and it is somewhat outdated I figured I would write a little how to.

I will try to keep this up to date so everyone who wants to use this ability will be able to use it without to much trouble

To add to @JosephH and @Rinat Abidullin's answers, I also found that it is possible to access the music files themselves from the Simulator (at least using the iOS 8 and 9 Simulators from Xcode 7.3). For this to work, I copied the following folders from my iPhone to the corresponding folder on my Mac (in addition to the files @JosephH mentioned):

  • /var/mobile/Media/iTunes_Control/Music
  • /var/mobile/Media/Purchases

The files can then be played by using an AVAudioSession to open the MPMediaItemPropertyAssetURL.

Update: There is also a very good sample project that can be used to easily test this out: GVMusicPlayerController.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!