Swift: Apple Mach-O Linker Error (file too small for architecture x86_64)

I had the same problem. It turned out to be that one of my frameworks I added externally could not be found. To fix it I removed the reference to it, re downloaded it, then re added it to my project.


Try a full rebuild / clean. It's possible that the a previous build has been abnormally aborted, leaving the ViewController.o file corrupted or zero-size.

To clean: In Xcode "Product" menu, select "Clean" (shortcut: Cmd+Shift+K)

To rebuild: In Xcode "Product" menu, select "Build" (shortcut: Cmd+B)

If it doesn't work: In Xcode "Product" menu, hold down Option key, and select "Clean Build Folder"

reference from HERE.


You don't (usually) have to clean, just open the file it mentions and resave it so that xcode thinks it changed. Then you can just do an incremental build (much faster).

Tags:

Ios

Xcode

Swift