ITLibrary musicFolderLocation wrong?

Hello fellow devs,


I have an app that I was working on to help me sync my iTunes library to different devices.

For that purpose I was using an ITLibrary object, specifically the musicFolderLocation() function.


However, after upgrading to Catalina, the location is all wrong. Instead of /Users/[me]/Music/iTunes/iTunes Media I am getting /Users/[me]/Music/1iTunes/iTunes Media. I don't know where the 1 is coming from.

I tried moving my library around to different places to see if the location changes, but it stayed the same.


If I retrieve my playlists with library.allPlayslists() and iterate through the items, all of the files have the correct location.

Only the musicFolderLocation() gets me the wrong path.

Any idea what the problem is or where the path is saved in the system?

Do I have to delete caches anywhere or set system-wider variables?

I am kind of confused as how this is supposed to work.


Kind Regards

SG

  • I have this problem as well using Xcode 13.2.1 and Swift 5.5.2. I think Apple broke something in the ITLibrary framework. When I call musicFolderLocation method on the ITLibrary, the URL path returned is completely fubar. It has “/Volumes/Music 1/iTunes/iTunes Media“. First of all, I don't even have a volume named “Music 1“ and I haven't used “iTunes“, or that naming convention, since Apple moonlighted it a long time ago. So I wanted to find out where the problem was, and it appears the ITLibrary is using a UserDefaults value from “iTunes-media-folder-url“ in “com.apple.AMPLibraryAgent.“ So I guess they still haven't gotten everything right with Music. The Music app is buggy as hell and I reported that to them since Catalina and it remains the same, if not worse with each new OS release. Anyway, I don't know if it would harm anything to manually rewrite that UserDefault or not, but until Apple fixes this, right now I don't see a way around it.

Add a Comment