xcrun simctl addmedia not working after deleting media

I have deleted the folder :

rm -rf ~/Library/Developer/CoreSimulator/Devices/<sim udid>/data/Media/**

It deleted the files and I am not able to see in Photos app.

But when I try to add media file again with command, I got error:

xcrun simctl addmedia <sim udid>  abc.png

Failed to import 'abc.png', error [PHPhotosErrorDomain] -1: The operation couldn’t be completed. (PHPhotosErrorDomain error -1.)

An error was encountered processing the command (domain=com.apple.CoreSimulator.LaunchdSimError, code=133):
Multiple errors were returned; see stderr

Note: If I do not delete the media then addmedia command working as expected, But I have a scenario where I need to clean all photos then add one file.

Simulator version: iOS 15.5 xcrun version: 61

  • Can anyone please have any info regarding the same ?

Add a Comment

Replies

tried with

  • after you remove the file
  • open Photos app "xcrun simctl openurl <sim udid> photos-redirect:"
  • kill the the photos app "xcrun simctl terminate <sim udid> com.apple.mobileslideshow"
  • try to upload your image again

works on my side hope this can help