1

I am using Xcode 7.3 on a Swift/Objective-C bridged iOS project. Some time ago, I had created a class called Ping in an associated file called Ping.swift. However, today, another engineer on the project decided we didn't need this file/class anymore so he deleted it and pushed his changes to git. It compiles fine for him. But, after pulling, it does not compile for me. Rather it produces this rather uninspiring compile error:

<unknown>:0: error: no such file or directory: '/Users/chris/Sites/glanceios/Glance/Glance/Controllers/utils/Ping.swift'
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1

Yes, I have already tried deleting derived data, then cleaning, recreating the file into the same spot, burning sage, doing a rain dance while facing west, etc...

FYI, neither this question, this one, nor this one are helpful. Even though they are each about the same Xcode error message, their causes are all subtly different and therefore their answers are not applicable.

Community
  • 1
  • 1
world
  • 3,932
  • 2
  • 10
  • 12

2 Answers2

2

After trying the following suggested by @theonethecallneo (manually deleting derived data via rm rf, git reset--hard, and following the great steps here which included a HARD CLEAN in Xcode (vs the soft clean we all do all the time) I still had no luck.

But then something else @theonetheycallneo tipped me off. It was suggested by neo that I search my project using an alternate IDE for references to this class. I did this and found them in the workspace. Ahaha it must be related to Pods.

So, the pod build must be hanging on to a reference to a class/file that no longer exists. Here is what I did to fix it from this point:

rm -rf ./Pods
rm -rf ./Podfile.lock
rm -rf ./Glance.xcworkspace
pod install

It took a while but that fixed it. Whew. Throw a #!/bin/bash on top of that and you got yourself a handy script, btw.

world
  • 3,932
  • 2
  • 10
  • 12
1

Ensure ./Glance/Glance/Helpers/Ping.swift is in your local directory from git repo.

enter image description here

Try to

git reset --hard HEAD

Open all files in Sublime or your preferred raw text editor and search for controllers/utils/Ping.swift and delete them. Sometimes there's ill references in your project files lingering.

Make sure your derived data folder is actually deleted with rm -rf ./{Derived-Data}/* (sometimes Xcode's cache just re-populates when other programs/plugins wipe the directory).

Sometimes Xcode needs a Force Quit to just delink all it's file references.

Pray to the Apple Gods.