Search code examples
xcodewatchkit

Error: Make Directory: No such file or directory


For some reason, I am getting these 2 errors when I try to run my app.

error: make directory /Users/ameya/Library/Developer/Xcode/DerivedData/TennisTracker-gnfmqlprqnkoxbabnbcmuxgmrskv/Build/Products/Debug-iphonesimulator/TennisTracker.app/Watch/Tennis Tracker WK.app/_WatchKitStub: No such file or directory error: couldn't remove

'/Users/ameya/Library/Developer/Xcode/DerivedData/TennisTracker-gnfmqlprqnkoxbabnbcmuxgmrskv/Build/Products/Debug-iphonesimulator/TennisTracker.app/Watch/Tennis Tracker WK.app' after command failed: Directory not empty

I am relatively new to xcode and don't really have an idea about what this error means or how to fix it. I currently attempted to upgrade from WatchOs1 to Watchos2 by deleting my old files. I've already had some troubles trying to fully get rid of my old files and implementing the new ones. Is this in anyway related to the error that I am facing?


Solution

  • You have spaces in your watch app Project name.

    This will lead to problems with file path, since the spaces aren't being escaped and the path isn't enclosed by double quotes.

    • For the first issue, the _WatchKitStub file couldn't be removed since the path wasn't escaped, so the file couldn't be found.

    • That triggered the second issue, when the now-quoted path couldn't be deleted (since the directory wasn't empty because the earlier command failed).

    How to fix this issue:

    You should create a new watch app target named TennisTrackerWK, change the target for your existing source files, then delete the old watch app target.