I'm trying to create a music player for iPhone and iPad. I get it working perfectly on my iPhone and iPad because those actually have a music library. However I want to use fastlane and some other tools with tests so I need to be able to see/add a music library to my simulator as well.
I've navigated to my emulator folder.
/Users/maikohermans/Library/Developer/CoreSimulator/Devices/8A14CCDB../Data
However I have no clue where to look and if I even should look here to add the music.
I hope someone can help me out here on how to do this. I've searched this but it seems like nobody asked this question for quite some time. So that means either everyone has given up on it or it is possible and I just can't seem to figure out how to do this.
Just like an APK (Android Application Package) file can be installed on Android devices, an IPA file can be used for testing iOS applications.
No, according to Apple here: Note: You cannot install apps from the App Store in simulation environments.
If you require a different version of the iOS simulator than is provided by your Xcode installation, you can download additional simulators in Xcode. Open Xcode and click Menu > Xcode > Preferences > Select Components, and then choose the simulator version you want to download.
Although the regular believe is that this can't be done I figured out how to do it thanks to the link @BaSha mentioned.
I wrote a little How To on it so everyone who faces the same problem or thinks it isn't possible will be able to get it working.
To give the gist of it you will need a few things.
To get the id of the device you want to test on you can run
xcrun simctl list
This will give you a list of all the available simulators, pick the one you want to use and copy the id, you will need this.
Now navigate to the directory of the simulator you just chose.
[yourHD] -> Users -> [yourusername] -> Library -> Developer -> CoreSimulator -> Devices -> [the ID you obtained in the previous step] -> data -> Media -> iTunes_Control -> iTunes
Now you have to open iFunBox
(connect your phone with music library to your pc). In iFunBox, select Raw File System
. In this you will find a directory called iTunes_Control
from that directory you need to copy some files and directories to the simulator directory you opened before. namely:
Music
iTunes/Artwork
iTunes/MediaLibrary.sqlitedb
iTunes/MediaLibrary.sqlitedb-shm
iTunes/MediaLibrary.sqlitedb-wal
If you ever bought music you should also grab the following directory Raw File System/Purchases
so I need to be able to see/add a music library to my simulator as well
You cannot do so. MPMediaLibrary APIs do not work on the simulator.
You can test your interface on the simulator by writing stub methods that stand between your code and the MPMediaLibrary APIs, but actual access to the user's music library is possible only on a device.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With