I am storing an .mp3 in my iOS apps documents directory and saving the path to Core Data. When I rebuild the app Xcode seems to move the application data to a different directory thus making the stored path invalid. Why is this happening and what are the best practices around saving file paths?
I am using Xcode 6.2 and have been successful retrieving the file in the past.
location of file after downloading:
in ~/Library/Developer/CoreSimulator/Devices/82D1931C-590D-45A2-AB9B-8D1D4F2530C5/data/Containers/Data/Application/
$ find . -iname p612.mp3
./1C070BF8-0E2E-4EAC-99B6-C56E48675E6E/Documents/adf07cf85254e8f28f942f2d6fa704ae/p612.mp3
Location of file after rebuilding:
in ~/Library/Developer/CoreSimulator/Devices/82D1931C-590D-45A2-AB9B-8D1D4F2530C5/data/Containers/Data/Application/
$ find . -iname p612.mp3
./E6C7D0AF-E61C-4BDD-AF4B-68C445E2BB0D/Documents/adf07cf85254e8f28f942f2d6fa704ae/p612.mp3
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…