Found an unexpected Mach-O header code: 0x72613c21 in Xcode 7

Solution 1:

Check two things for every framework:

  1. The Mach-O type of the framework (in Build Settings of the framework target)

Mach-O

  1. Whether you copy the framework by putting it in Build Phases -> Embed Frameworks (or Copy Bundle Resources as mentioned by a. brooks hollar)

Embed frameworks

If the Mach-O type of the framework is "static library", it should not be put in embed frameworks; if the Mach-O type is "dynamic library", it should be put in embed frameworks.

In my case it was SocketRocket I added manually which has both a static library target and a dynamic library target with the same framework name. After deleting the static library target and only embed the dynamic library framework, the problem disappears.


Note:

If you don't have access to the source project, you can manually check if it's a dynamic or static framework using this approach: https://stackoverflow.com/a/32591983/308315

Solution 2:

I don't know why but somehow pods appeared to become an embedded binary. So I had to remove it, pod install once more, and the issue disappeared.

enter image description here

On Xcode 11 you need to change it to Do Not Embed in the Frameworks, Libraries, and Embedded Content.

Solution 3:

Double check Build Phases -> Copy Bundle Resources for a framework or other binary that shoundn't be there.

In my case, it was a 3rd party library (Parse) that I had added.