Error while attempting to run my app using Xcode 8

2019-04-11 13:36发布

I know a lot of people are getting this error when trying to compile their app in Xcode 8 Beta 3, however none of the available answers here seemed to help me.

While trying to run my app, I got the usual error: (null): Found an unexpected Mach-O header code: 0x72613c21, and when I expanded the information, I was given this in return:

Effective srcDirs: {(
    <DVTFilePath:0x6000008bb0c0:'/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos'>,
    <DVTFilePath:0x6080002a00c0:'/Applications/Xcode-beta.app/Contents/Developer/Toolchains/Swift_2.3.xctoolchain/usr/lib/swift/iphoneos'>
)}
error: Found an unexpected Mach-O header code: 0x72613c21

Note: I see something in the file path about Swift_2.3 which might lead to some answers, but I am not sure.

It could have also possibly been a problem with my Podfile, so I followed the directions posted in this StackOverflow answer and pasted the following line of code into my podfile, so that at the end my podfile looked like this:

# Uncomment this line to define a global platform for your project
platform :ios, '9.0'

target 'Roast' do
  # Comment this line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

pod 'Firebase'
pod 'Firebase/Core'
pod 'Firebase/Database'
pod 'Firebase/Auth'
pod 'Firebase/AdMob'
pod 'JSQMessagesViewController'

  target 'RoastTests' do
    inherit! :search_paths
    # Pods for testing
  end

end

target 'RoastKeyboard' do
  # Comment this line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!
  pod 'Firebase'
  pod 'Firebase/Core'
  pod 'Firebase/Database'
  pod 'Firebase/Auth'

  # Pods for RoastKeyboard

end

post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES'] = 'NO'
        end
    end
end

And I updated my pods.

However, that effectively did nothing.

This is a super annoying error, because I just spent the last two hours fixing bugs in my code and now I get an error that is probably not even my fault.

If anybody could help me out, that would be awesome. Thanks!

标签: ios xcode xcode8
1条回答
ゆ 、 Hurt°
2楼-- · 2019-04-11 14:29

Looks like this issue has been fixed in Xcode 8.0 (beta 4).. So you don't need to try following stuff.

Issue seems to be with Xcode was getting confused with Toolchain directory path, when build includes both swift and objc headers.

One way to fix is

  1. Patch the SDK header files for use with the compiler ( stupid thing doesn't like the new headers! ) or
  2. Use the old header files ( which are great, but some things dont work/exist the same anymore! ) or
  3. Use the following settings in your Makefile to avoid warnings and errors during compilation and linking:

CC=/usr/bin/clang

CFLAGS=-fsigned-char -g -ObjC -fobjc-exceptions \ -Wall -Wundeclared-selector -Wreturn-type -Wnested-externs \ -Wredundant-decls \ -Wbad-function-cast \ -Wchar-subscripts \ -Winline -Wswitch -Wshadow \ -I/var/include \ -I/var/include/gcc/darwin/4.0 \ -D_CTYPE_H_ \ -D_BSD_ARM_SETJMP_H \ -D_UNISTD_H_

CPPFLAGS=

LD=$(CC)

LDFLAGS=-lobjc \ -F/System/Library/Frameworks \ -framework CoreFoundation \ -framework Foundation \ -framework UIKit \ -framework CoreGraphics \ -L/usr/lib -lc /usr/lib/libgcc_s.1.dylib \ -bind_at_load \ -multiply_defined suppress

查看更多
登录 后发表回答