ios - 尝试使用 Xcode 8 Beta 3 运行我的应用程序时出错

标签 ios xcode xcode8

我知道很多人在尝试在 Xcode 8 Beta 3 中编译应用程序时遇到此错误,但是这里的可用答案似乎都对我没有帮助。

在尝试运行我的应用程序时,我收到了常见的错误:(null): Found an Unexpected Mach-O header code: 0x72613c21,当我扩展信息时,我得到了这个返回:

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

注意:我在文件路径中看到有关 Swift_2.3 的内容,这可能会导致一些答案,但我不确定。

这也可能是我的 Podfile 的问题,所以我按照 this StackOverflow answer 中发布的说明进行操作并将以下代码行粘贴到我的 podfile 中,这样最后我的 podfile 看起来像这样:

# 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

我更新了我的 Pod。

但是,这实际上没有任何作用。

这是一个 super 烦人的错误,因为我刚刚花了两个小时修复代码中的错误,现在我收到一个错误,这可能不是我的错。

如果有人能帮助我,那就太棒了。谢谢!

最佳答案

看起来这个问题已在 Xcode 8.0(测试版 4)中得到修复。。所以你不需要尝试以下内容。

问题似乎是 Xcode 与工具链目录路径混淆,当构建包含 swift 和 objc header 时。

一种解决方法是

  1. 修补 SDK 头文件以与编译器一起使用(愚蠢的事情 不喜欢新标题! ) 或
  2. 使用旧的头文件(其中 很棒,但有些东西不再起作用/不再存在了! )或
  3. 在 Makefile 中使用以下设置以避免警告和 编译和链接期间出现错误:

CC=/usr/bin/clang

CFLAGS=-fsigned-char -g -ObjC -fobjc-异常\ -Wall -Wundeclared-selector -Wreturn-type -Wnested-externs\ -Wredundant-声明\ -Wbad-函数-cast\ -Wchar-下标\ -Winline -Wswitch -Wshadow\ -I/var/包括\ -I/var/include/gcc/darwin/4.0\ -D_CTYPE_H_\ -D_BSD_ARM_SETJMP_H\ -D_UNISTD_H_

CPPFLAGS=

LD=$(CC)

LDFLAGS=-lobjc\ -F/系统/库/框架\ -框架CoreFoundation\ -框架基础\ -框架 UIKit\ - 框架 CoreGraphics\ -L/usr/lib -lc/usr/lib/libgcc_s.1.dylib\ -bind_at_load\ -multiply_define 抑制

关于ios - 尝试使用 Xcode 8 Beta 3 运行我的应用程序时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38537684/

相关文章:

swift - 如何快速从外部应用程序启动 yandex map 应用程序?

swift3 - 牛顿 Gradle Playground 是否已移植到使用 swift 3 代码

ios - 将pem证书添加到项目中

objective-c - 更改设置时更新 UIWebView

ios - 没有这样的模块 'GoogleMobileAds'

ios - 我可以在我的 iOS 应用程序中添加/删除我的自定义设置包吗?

iphone - ImageView contentMode 正确缩放图像?

objective-c - MD5在Mac上的应用程序?

ios - 配置文件 iOS 团队即将到期(免费帐户)

ios - Xcode 8.3.3 问题调用 String.index(of :)