Xcode linker error: file too small for architecture x86_64
I usually add a space (could be any character for that matter) to the file in question, remove it and then save. Easier and quicker than a clean build.
Stealing @martin-baulig's answer:
Try a full rebuild / clean. It's possible that the previous build has been abnormally aborted, leaving the TWRAppDelegate.o file corrupted or zero-size.
To automatically fix this issue Build Script Phase
can be added. Goto Xcode -> Your Project -> Your Target -> Build Phases -> + -> New Run Script Phase
Rename it to Xcode Link Fix
and move it above Compile Sources
phase. Paste this into script body:
# Legacy build system
legacy_dir=`dirname "${LD_DEPENDENCY_INFO_FILE}"`
if [ -d "${legacy_dir}" ]; then
find "${legacy_dir}" -size 0 | while read -d $'\n' file; do
rm "$file"
done
fi
# New build system
if [ -d "${OBJECT_FILE_DIR_normal}" ]; then
find "${OBJECT_FILE_DIR_normal}" -size 0 | while read -d $'\n' file; do
rm "$file"
done
fi
This script checks for object files with zero size and removes them so when compilation is done in next step it success.
You need to add this script for every app target if you have many.
This script takes ~0.1 second to run and saves you from full project rebuild.