"I’ve been struggling with this issue for two weeks, and I’ve tried everything I could think of. The error I kept encountering was:
file cannot be open()ed, errno=2 path=path_to_my_project/arm64/xxxxx.o;
After a lot of trial and error, here's what finally worked for me:
- Identify the files referenced in the error (in this case, xxxxx.o).
- Open your Xcode project and locate the xxxxx.swift file mentioned in the error.
- Rename the xxxxx.swift file to xxxxx_old.swift.
- Create a new untitled file in the same folder, and give it the original name (xxxxx.swift).
- Copy the code from the xxxxx_old.swift file into the newly created xxxxx.swift.
- Rebuild the project. In the build log, the error should now reference the xxxxx_old.o instead of the xxxxx.o that was previously causing the issue.
- Delete the xxxxx_old.swift file, then rebuild the project again.
After doing this, the error should no longer appear in the log for that class. I had to repeat this process for every file referenced in the log. In some cases, I had to apply the same steps twice for the same file for the solution to work.
Good luck and let me know if it helped.
Best regards,