Validation 在Xcode 7中发现意外的Mach-O标头代码:0x72613c21

Validation 在Xcode 7中发现意外的Mach-O标头代码:0x72613c21,validation,dynamic,frameworks,store,Validation,Dynamic,Frameworks,Store,我有一个使用ObjC动态框架的Swift项目,该框架必须链接并嵌入到我的项目中。项目在设备中运行正常,提交到App Store时,验证过程中出现错误: 发现意外的Mach-O标头代码:0x72613c21 以下是验证日志: 2015-10-12 02:32:33 +0000 [MT] Beginning distribution assistant for archive: MusicFans, task: Validate 2015-10-12 02:32:33 +0000 [MT] Auto

我有一个使用ObjC动态框架的Swift项目,该框架必须链接并嵌入到我的项目中。项目在设备中运行正常,提交到App Store时,验证过程中出现错误:
发现意外的Mach-O标头代码:0x72613c21

以下是验证日志:

2015-10-12 02:32:33 +0000 [MT] Beginning distribution assistant for archive: MusicFans, task: Validate
2015-10-12 02:32:33 +0000 [MT] Automatically selecting the only availaable distribution method <IDEDistributionMethodiOSAppStoreValidation: 0x7f851c1d96c0>
2015-10-12 02:32:34 +0000 [MT] [OPTIONAL] Didn't find archived user entitlements for <DVTFilePath:0x7f851b42db10:'/Users/panzhansheng/Library/Developer/Xcode/Archives/2015-10-11/MusicFans 11-10-15 上午8.29.xcarchive/Products/Applications/MusicFans.app/Frameworks/libswiftDispatch.dylib'>: Error Domain=NSCocoaErrorDomain Code=4 "Item at "/Users/panzhansheng/Library/Developer/Xcode/Archives/2015-10-11/MusicFans 11-10-15 上午8.29.xcarchive/Products/Applications/MusicFans.app/Frameworks/libswiftDispatch.dylib" did not contain a "archived-expanded-entitlements.xcent" resource." UserInfo={NSLocalizedDescription=Item at "/Users/panzhansheng/Library/Developer/Xcode/Archives/2015-10-11/MusicFans 11-10-15 上午8.29.xcarchive/Products/Applications/MusicFans.app/Frameworks/libswiftDispatch.dylib" did not contain a "archived-expanded-entitlements.xcent" resource.}
2015-10-12 02:32:34 +0000 [MT] [OPTIONAL] Didn't find archived user entitlements for <DVTFilePath:0x7f8529a08050:'/Users/panzhansheng/Library/Developer/Xcode/Archives/2015-10-11/MusicFans 11-10-15 上午8.29.xcarchive/Products/Applications/MusicFans.app/wavpack.framework'>: Error Domain=NSCocoaErrorDomain Code=4 "Item at "/Users/panzhansheng/Library/Developer/Xcode/Archives/2015-10-11/MusicFans 11-10-15 上午8.29.xcarchive/Products/Applications/MusicFans.app/wavpack.framework" did not contain a "archived-expanded-entitlements.xcent" resource." UserInfo={NSLocalizedDescription=Item at "/Users/panzhansheng/Library/Developer/Xcode/Archives/2015-10-11/MusicFans 11-10-15 上午8.29.xcarchive/Products/Applications/MusicFans.app/wavpack.framework" did not contain a "archived-expanded-entitlements.xcent" resource.}
2015-10-12 02:32:34 +0000 [MT] [OPTIONAL] Didn't find archived user entitlements for <DVTFilePath:0x7f850da13de0:'/Users/panzhansheng/Library/Developer/Xcode/Archives/2015-10-11/MusicFans 11-10-15 上午8.29.xcarchive/Products/Applications/MusicFans.app/FLAC.framework'>: Error Domain=NSCocoaErrorDomain Code=4 "Item at "/Users/panzhansheng/Library/Developer/Xcode/Archives/2015-10-11/MusicFans 11-10-15 上午8.29.xcarchive/Products/Applications/MusicFans.app/FLAC.framework" did not contain a "archived-expanded-entitlements.xcent" resource." UserInfo={NSLocalizedDescription=Item at "/Users/panzhansheng/Library/Developer/Xcode/Archives/2015-10-11/MusicFans 11-10-15 上午8.29.xcarchive/Products/Applications/MusicFans.app/FLAC.framework" did not contain a "archived-expanded-entitlements.xcent" resource.}
2015-10-12 02:33:07 +0000 [MT] Canceled distribution assistant
2015-10-12 02:32:33+0000[MT]开始分发存档助手:音乐助手,任务:验证
2015-10-12 02:32:33+0000[MT]自动选择唯一可用的分配方式
2015-10-12 02:32:34+0000[MT][可选]未在“/Users/panzhansheng/Library/Developer/Xcode/Archives/2015-10-11/MusicFans 11-10-15”中找到存档用户权限:错误域=nscocaerorDomain代码=4”上午8.29.xarchive/Products/Applications/MusicFans.app/Frameworks/libswiftDispatch.dylib“未包含“已归档的扩展权限.xcent”资源。UserInfo={NSLocalizedDescription=Item at”/Users/panzhanseng/Library/Developer/Xcode/Archives/2015-10-11/MusicFans 11-10-15上午8.29.xarchive/Products/Applications/MusicFans.app/Frameworks/libswiftDispatch.dylib“未包含“已存档的扩展权限.xcent”资源。}
2015-10-12 02:32:34+0000[MT][可选]未在“/Users/panzhansheng/Library/Developer/Xcode/Archives/2015-10-11/MusicFans 11-10-15”中找到存档用户权限:错误域=nscocaerorDomain代码=4”上午8.29.xarchive/Products/Applications/MusicFans.app/wavpack.framework“未包含”存档的扩展权限.xcent“资源”。UserInfo={NSLocalizedDescription=Item at”/Users/panzhansheng/Library/Developer/Xcode/Archives/2015-10-11/MusicFans 11-10-15上午8.29.xarchive/Products/Applications/MusicFans.app/wavpack.framework“未包含“已存档的扩展权限.xcent”资源。}
2015-10-12 02:32:34+0000[MT][可选]未在“/Users/panzhansheng/Library/Developer/Xcode/Archives/2015-10-11/MusicFans 11-10-15”中找到存档用户权限:错误域=nscocaerorDomain代码=4”上午8.29.xarchive/Products/Applications/MusicFans.app/FLAC.framework“未包含”存档的扩展权限.xcent“资源”。UserInfo={NSLocalizedDescription=Item at”/Users/panzhansheng/Library/Developer/Xcode/Archives/2015-10-11/MusicFans 11-10-15上午8.29.xarchive/Products/Applications/MusicFans.app/FLAC.framework“未包含“已存档的扩展权限.xcent”资源。}
2015-10-12 02:33:07+0000[MT]取消分销助理
如果我从项目的Embedded framework部分删除动态框架,那么它可以通过验证,但在设备中运行时会崩溃,因为我的动态框架缺少映像,你知道吗?
顺便说一句,动态框架禁用了位代码,所以我的项目也禁用了位代码,并且没有进行代码签名。

我也遇到了同样的问题。我做了几件事,我的问题就消失了。我相信我的问题与Cocoapods版本有关,但是你可以在这里尝试一些东西

首先通过以下方式清除数据:

1.关闭Xcode

2.转到./Users/YourFile/Library/Developer/Xcode/DerivedData

3.删除此文件夹中的所有内容

4.运行Xcode

5.建造和清洁

其次,由于某种原因,在最新的cocoa pods版本0.39中,我在运行
pod安装时收到了以下警告

[!]MY_TARTGET
target会覆盖
EMBEDDED_CONTENT_包含的_SWIFT
build设置,该设置在'Pods/target Support Files/Pods/Pods.release.xcconfig'中定义。这可能会导致CocoaPods安装出现问题

我已通过删除所有已安装的CoCoapod降低了CoCoapod的等级:

sudo gem卸载cocoapods

然后安装旧版本:

sudogem安装cocoapods-v0.38.1


这删除了警告,并且我能够删除错误,“意外的Mach-O头代码:0x72613c21”

仔细检查构建阶段->复制框架或其他不应该存在的二进制文件的捆绑资源


在我的例子中,它是我添加的第三方库(Parse)。

在我的例子中,它是由开发人员证书/团队的更改引起的

我用个人开发者苹果ID启动项目,当我把它改成我的工作ID时。 当我们尝试导出.xcshive时,出现了“Match-O header”失败。 这里或其他网站的任何描述都不会改变任何事情


当我将团队更改回我的个人ID时,错误日志显示现在只有少数框架(最近添加的)缺少.xcent文件。所以我开始了一个全新的项目,粘贴了所有的源代码和文件,然后运行cocoapod,一切都正常工作。

编辑:这看起来在Xcode 8 Beta 3中得到了修复

我目前在Xcode 8 Beta 2和带有纯Swift吊舱的Swift 3上遇到了这个问题(这似乎是问题的根源)

将以下内容添加到我的Podfile已修复该问题

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

YuAo在GitHub上的功劳。我在Xcode 8 beta 3中也遇到了同样的问题。我修复了从链接框架中删除Fabric和Crashlytics的问题(Project=>Target=>General page)(

Mike from Fabric here)


这是Xcode Beta 2和3中的一个错误,在Beta 4中已修复,更新到最新版本将解决此问题。

我在FacebookSDK框架中遇到此错误。我在构建阶段将其从嵌入框架列表中删除,它解决了这个问题。检查日志,找到其他人提到的导致错误的框架。

在Swift 2.3非CoCoCoapods项目中手动添加的PFFacebookUtils框架存在此问题。我通过将上述框架从构建目标的“常规”页面的“嵌入式框架”部分删除并在构建阶段将其链接->将二进制文件链接到库来修复它

为每个框架检查两件事:

  • 框架的Mach-O类型(框架目标的内置设置)
  • Whe
    target 'AppPipe' do
      platform :osx, '10.14'
      project 'AppPipe/AppPipe.xcodeproj'
      pod 'Yams'
    
      post_install do |installer|
        installer.pods_project.targets.each do |target|
          target.build_configurations.each do |config|
            config.build_settings['MACH_O_TYPE'] = 'staticlib'
          end
        end
      end
    end
    
    
    target 'AppPipe' do
      platform :osx, '10.14'
      project 'AppPipe/AppPipe.xcodeproj'
      pod 'Yams'
    end
    
    post_install do |installer|
      installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            # Only AppPipe always gets staticlib
            if target.name == 'AppPipe'
              config.build_settings['MACH_O_TYPE'] = 'staticlib'
            end
        end
      end
    end
    
    App(with all the code in one target)
    
    B -> C
    A -> B
    
    App -> A
    App -> B
    App -> C
    
    App -> D
    
    D -> A
    D -> B
    D -> C
    
    # https://github.com/firebase/firebase-ios-sdk/issues/6472
    LOGFILE="${ARCHIVE_PATH}/static-frameworks.log"
    echo "Removing static frameworks from ${WRAPPER_NAME} archive" > $LOGFILE
    find "${ARCHIVE_PRODUCTS_PATH}/Applications/${WRAPPER_NAME}" -name '*.framework' -print0 | while IFS= read -r -d '' fm; do
        name=$(basename "${fm}" .framework)
        target="${fm}/${name}"
        echo "Checking: ${fm}" >> $LOGFILE
        if file "${target}" | grep -q "current ar archive"; then
            rm -rf "${fm}"
            echo "Removed static framework: ${fm}" >> $LOGFILE
        fi
    done
    
    LOGFILE="${ARCHIVE_PATH}/static-frameworks.log"
    echo "Removing static frameworks from ${WRAPPER_NAME} archive" > $LOGFILE
    find "${ARCHIVE_PRODUCTS_PATH}/Applications/${WRAPPER_NAME}" -name '*.framework' -print0 | while IFS= read -r -d '' fm; do
        name=$(basename "${fm}" .framework)
        target="${fm}/${name}"
        echo "Checking: ${fm}" >> $LOGFILE
        if file "${target}" | grep -q "current ar archive"; then
            rm -rf "${fm}"
            echo "Removed static framework: ${fm}" >> $LOGFILE
        fi
    done
    
    # Fixes binary framework bug, see:
    # https://developer.apple.com/documentation/xcode-release-notes/xcode-12_4-release-notes#Swift-Packages
    # https://github.com/firebase/firebase-ios-sdk/issues/6472
    
    echo "Removing static frameworks from ${TARGET_NAME}.app"
    find "${BUILT_PRODUCTS_DIR}/${TARGET_NAME}.app/" -name '*.framework' -print0 | while IFS= read -r -d '' fm; do
        name=$(basename "${fm}" .framework)
        target="${fm}/${name}"
        echo "Checking: ${fm}"
        if file "${target}" | grep -q "current ar archive"; then
            rm -rf "${fm}"
            echo "Removed static framework: ${fm}"
        fi
    done