来自iTC的无效Bundle错误,无法提交应用程序 - 因为4个swift dylib无法嵌入

时间:2016-09-14 01:22:35

标签: ios swift xcode cocoa-touch watchkit

我的应用在设备上正常运行模拟器,但当我提交它时,我得到无效的捆绑包 - 你的应用程序引用的一个或多个动态库不存在于dylib搜索路径中错误通过电子邮件发送给我大约半小时后上传成功完成。

根据对此here的建议,即运行otool -L,我可以看到该应用的主可执行文件包含@rpath/...dylib文件夹中的所有Frameworks/个文件预期,,appex的可执行文件缺少一些Swift库。

以下是appex上otool -L的输出:

Watch Extension:
    /System/Library/Frameworks/WatchKit.framework/WatchKit (compatibility version 1.0.0, current version 1.0.0)
    /System/Library/Frameworks/Foundation.framework/Foundation (compatibility version 300.0.0, current version 1349.0.0)
    /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.0.0)
    /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation (compatibility version 150.0.0, current version 1348.0.0)
    /System/Library/Frameworks/UIKit.framework/UIKit (compatibility version 1.0.0, current version 3599.4.0)
    /System/Library/Frameworks/WatchConnectivity.framework/WatchConnectivity (compatibility version 1.0.0, current version 116.0.0)
    @rpath/libswiftCore.dylib (compatibility version 1.0.0, current version 800.0.46)
    @rpath/libswiftCoreGraphics.dylib (compatibility version 1.0.0, current version 800.0.46)
    @rpath/libswiftCoreLocation.dylib (compatibility version 1.0.0, current version 800.0.46)
    @rpath/libswiftDarwin.dylib (compatibility version 1.0.0, current version 800.0.46)
    @rpath/libswiftDispatch.dylib (compatibility version 1.0.0, current version 800.0.46)
    @rpath/libswiftFoundation.dylib (compatibility version 1.0.0, current version 800.0.46)
    @rpath/libswiftHomeKit.dylib (compatibility version 1.0.0, current version 800.0.46)
    @rpath/libswiftObjectiveC.dylib (compatibility version 1.0.0, current version 800.0.46)
    @rpath/libswiftSceneKit.dylib (compatibility version 1.0.0, current version 800.0.46)
    @rpath/libswiftUIKit.dylib (compatibility version 1.0.0, current version 800.0.46)
    @rpath/libswiftWatchKit.dylib (compatibility version 1.0.0, current version 800.0.46)
    @rpath/libswiftsimd.dylib (compatibility version 1.0.0, current version 800.0.46)

以下不在Frameworks/文件夹中(但所有其他文件夹都是):

    @rpath/libswiftHomeKit.dylib (compatibility version 1.0.0, current version 800.0.46)
    @rpath/libswiftSceneKit.dylib (compatibility version 1.0.0, current version 800.0.46)
    @rpath/libswiftWatchKit.dylib (compatibility version 1.0.0, current version 800.0.46)
    @rpath/libswiftsimd.dylib (compatibility version 1.0.0, current version 800.0.46)

这是为什么?我通过pod install重新生成了我的pods项目,没有改变任何东西。我没有看到任何警告。我检查了build(archive)的日志输出,也没有警告。我怎样才能将它们包括在内?

在我的主应用程序目标中,始终嵌入Swift标准库设置为yes。在Watch and Watch Appex目标中,将其设置为no以避免拒绝重复(好)。我尝试在我的appex中将EMBEDDED_CONTENT_CONTAINS_SWIFT设置为yes,如其他线程所述,但这没有任何区别。

更新1 - 我也无法从xcode管理器导出为ADHOC版本,它在“编译bitcode”步骤中出于同样的原因失败。运行时搜索路径设置如下:

Runtime search paths in build settings

以下是导出失败的日志片段,有任何想法如何解决这些问题?我认为没有理由缺少这些库。

    Debug: Command took 0 seconds
    Debug: Found framework/dylib: /Applications/Xcode.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS3.0.sdk/System/Library/Frameworks/WatchKit.framework/WatchKit.tbd
    Debug: Found framework/dylib: /Applications/Xcode.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS3.0.sdk/System/Library/Frameworks/Foundation.framework/Foundation.tbd
    Debug: Found framework/dylib: /Applications/Xcode.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS3.0.sdk/usr/lib/libobjc.A.tbd
    Debug: Found framework/dylib: /Applications/Xcode.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS3.0.sdk/usr/lib/libSystem.B.tbd
    Debug: Found framework/dylib: /Applications/Xcode.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS3.0.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation.tbd
    Debug: Found framework/dylib: /Applications/Xcode.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS3.0.sdk/System/Library/Frameworks/UIKit.framework/UIKit.tbd
    Debug: Found framework/dylib: /Applications/Xcode.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS3.0.sdk/System/Library/Frameworks/WatchConnectivity.framework/WatchConnectivity.tbd
    Debug: Found framework/dylib: /Applications/Xcode.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS3.0.sdk/usr/lib/libobjc.A.tbd
    Debug: Search Path: ['/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.0.0/lib/darwin', '/Applications/Xcode.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS3.0.sdk/usr/lib', '/Applications/Xcode.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS3.0.sdk/System/Library/Frameworks']
    error: libswiftCore.dylib not found in dylib search path


Stderr:
    from /Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:1974:in `block in CompileOrStripBitcodeInBundle'
    from /Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:1931:in `each'
    from /Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:1931:in `CompileOrStripBitcodeInBundle'
    from /Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:1921:in `block in CompileOrStripBitcodeInBundle'
    from /Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:1920:in `each'
    from /Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:1920:in `CompileOrStripBitcodeInBundle'
    from /Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:2106:in `ProcessIPA'
    from /Applications/Xcode.app/Contents/Developer/usr/bin/ipatool:2674:in `<main>'
2016-09-14 15:33:40 +0000  /Applications/Xcode.app/Contents/Developer/usr/bin/ipatool exited with 1
2016-09-14 15:33:40 +0000  ipatool JSON: {
    alerts =     (
            {
        code = 2554;
        description = "Configuration issue: platform AppleTVSimulator.platform doesn't have any non-simulator SDKs; ignoring it";
        info =             {
        };
        level = WARN;
    },
            {
        code = 2554;
        description = "Configuration issue: platform iPhoneSimulator.platform doesn't have any non-simulator SDKs; ignoring it";
        info =             {
        };
        level = WARN;
    },
            {
        code = 2554;
        description = "Configuration issue: platform WatchSimulator.platform doesn't have any non-simulator SDKs; ignoring it";
        info =             {
        };
        level = WARN;
    },
            {
        code = 284;
        description = "Failed to resolve linkage dependency Watch Extension armv7k -> @rpath/libswiftCore.dylib: Could not find image to link for armv7k in /private/var/folders/yl/mw_r1p4j3vj2mfp32rqs0y7r0000gn/T/XcodeDistPipeline.6Tu/Root/Payload/Photobooth.app/Frameworks/libswiftCore.dylib";
        info =             {
        };
        level = WARN;
    },
            {
        code = 284;
        description = "Failed to resolve linkage dependency Watch Extension armv7k -> @rpath/libswiftCoreGraphics.dylib: Could not find image to link for armv7k in /private/var/folders/yl/mw_r1p4j3vj2mfp32rqs0y7r0000gn/T/XcodeDistPipeline.6Tu/Root/Payload/Photobooth.app/Frameworks/libswiftCoreGraphics.dylib";
        info =             {
        };
        level = WARN;
    },
            {
        code = 284;
        description = "Failed to resolve linkage dependency Watch Extension armv7k -> @rpath/libswiftCoreLocation.dylib: Could not find image to link for armv7k in /private/var/folders/yl/mw_r1p4j3vj2mfp32rqs0y7r0000gn/T/XcodeDistPipeline.6Tu/Root/Payload/Photobooth.app/Frameworks/libswiftCoreLocation.dylib";
        info =             {
        };
        level = WARN;
    },
            {
        code = 284;
        description = "Failed to resolve linkage dependency Watch Extension armv7k -> @rpath/libswiftDarwin.dylib: Could not find image to link for armv7k in /private/var/folders/yl/mw_r1p4j3vj2mfp32rqs0y7r0000gn/T/XcodeDistPipeline.6Tu/Root/Payload/Photobooth.app/Frameworks/libswiftDarwin.dylib";
        info =             {
        };
        level = WARN;
    },
            {
        code = 284;
        description = "Failed to resolve linkage dependency Watch Extension armv7k -> @rpath/libswiftDispatch.dylib: Could not find image to link for armv7k in /private/var/folders/yl/mw_r1p4j3vj2mfp32rqs0y7r0000gn/T/XcodeDistPipeline.6Tu/Root/Payload/Photobooth.app/Frameworks/libswiftDispatch.dylib";
        info =             {
        };
        level = WARN;
    },
            {
        code = 284;
        description = "Failed to resolve linkage dependency Watch Extension armv7k -> @rpath/libswiftFoundation.dylib: Could not find image to link for armv7k in /private/var/folders/yl/mw_r1p4j3vj2mfp32rqs0y7r0000gn/T/XcodeDistPipeline.6Tu/Root/Payload/Photobooth.app/Frameworks/libswiftFoundation.dylib";
        info =             {
        };
        level = WARN;
    },
            {
        code = 284;
        description = "Failed to resolve linkage dependency Watch Extension armv7k -> @rpath/libswiftHomeKit.dylib: Could not resolve @rpath in @rpath/libswiftHomeKit.dylib from Watch Extension";
        info =             {
        };
        level = WARN;
    },
            {
        code = 284;
        description = "Failed to resolve linkage dependency Watch Extension armv7k -> @rpath/libswiftObjectiveC.dylib: Could not find image to link for armv7k in /private/var/folders/yl/mw_r1p4j3vj2mfp32rqs0y7r0000gn/T/XcodeDistPipeline.6Tu/Root/Payload/Photobooth.app/Frameworks/libswiftObjectiveC.dylib";
        info =             {
        };
        level = WARN;
    },
            {
        code = 284;
        description = "Failed to resolve linkage dependency Watch Extension armv7k -> @rpath/libswiftSceneKit.dylib: Could not resolve @rpath in @rpath/libswiftSceneKit.dylib from Watch Extension";
        info =             {
        };
        level = WARN;
    },
            {
        code = 284;
        description = "Failed to resolve linkage dependency Watch Extension armv7k -> @rpath/libswiftUIKit.dylib: Could not find image to link for armv7k in /private/var/folders/yl/mw_r1p4j3vj2mfp32rqs0y7r0000gn/T/XcodeDistPipeline.6Tu/Root/Payload/Photobooth.app/Frameworks/libswiftUIKit.dylib";
        info =             {
        };
        level = WARN;
    },
            {
        code = 284;
        description = "Failed to resolve linkage dependency Watch Extension armv7k -> @rpath/libswiftWatchKit.dylib: Could not resolve @rpath in @rpath/libswiftWatchKit.dylib from Watch Extension";
        info =             {
        };
        level = WARN;
    },
            {
        code = 284;
        description = "Failed to resolve linkage dependency Watch Extension armv7k -> @rpath/libswiftsimd.dylib: Could not resolve @rpath in @rpath/libswiftsimd.dylib from Watch Extension";
        info =             {
        };
        level = WARN;
    },

6 个答案:

答案 0 :(得分:17)

需要花费12个小时来解决这个问题,但这就是修复它的原因 - 更改ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES构建设置:

App target (主要目标) - 设置为NO(我的是YES)

观看目标 - 设置为YES(我没有)

观看应用扩展程序目标 - 设置为NO(我的判断为是)

编辑:我通过在xcode 8中创建一个新的空的监视项目来解决这个问题,并交叉引用新的xcode 8模板项目中的构建设置与我的老硬盘之间的差异古代项目。上面的设置是xcode 8模板项目的内容。

答案 1 :(得分:4)

我想详细说明我对这个问题的经验,希望如果他们遇到这个问题,可以节省一些时间。

<强>背景

  1. 较早的项目源自iOS 8,WatchOS 1.0 App和Today Extension
  2. 将应用程序从Swift 1.0更新到Swift 3.0.1,将目标iOS从8更新到10,watchOS从1.0升级到3.0
  3. 此次更新开始使用Cocoa Pods,原来不是
  4. @xaphod缺少库,当我运行otool -L时,每个目标中的所有库看起来都是正确的。

    在经过许多被拒绝的二进制文件后,我终于:

    1. 从项目中卸载了Cocoapods,suggested here
    2. 将Cocoapods更新为最新的非beta版
    3. 重新安装Cocoapods,将应用,观看应用,观看扩展程序,今日扩展程序和测试目标中的广告目标从 应用程序减少(因为主应用程序只是使用pods)
    4. 点击此处发布的@xaphod建议创建新模板项目(不使用pod)并比较构建设置,尤其是ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES
    5. 设置ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES
    6. 每个可可豆荚警告提示

      主应用目标 = $(inherited)。默认为YES,实际上在Xcode中显示为YES - $(inherited)。最后,每个pod设置EMBEDDED_CONTENT_CONTAINS_SWIFT = YES哪个pod为你做

      观看应用 = YES

      观看扩展程序 = NO

      今天延期 = NO

      在进行上述设置之前,我尝试了$(inherited)一切让可可豆袋开心。这显然是一个糟糕的人生决定。

      我终于发现,如果二进制文件不被iTunes Connect接受,尝试导出为AD HOC会失败,因此我可以节省测试理论的时间,然后再将构建投射到Apple。 我试图将一个成功的二进制文件与一个失败的二进制文件进行比较,但实际上没有看到任何特别突出的信息。

      我仍然不会对我如何工作感到百分之百的满意但很高兴我终于可以上传二进制文件了。干杯,祝你好运!

答案 2 :(得分:0)

太棒了,我遇到了同样的问题

如果您在参考路径中看到一些绝对路径,请查看您的Embeded Binaries Section。 您可以从左侧的项目树中删除框架,然后重新添加框架。确保路径为..in build/Debug-iphoneos

祝你好运!

答案 3 :(得分:0)

我最近在Xcode 10.1中遇到了此问题,并且所有框架都被正确引用。似乎苹果的验证过程中有一些变化,可能是一个错误,可能不是苹果的终结,但是我以前的所有构建都已上传并经过验证,很好-从那以后我没有添加任何新框架。

将二进制文件上传到iTunesConnect时,会看到以下错误:

  

无效的捆绑包-由一个或多个动态库引用   您的应用程序不在dylib搜索路径中。

     

无效的捆绑包-该应用使用Swift,但是其中一个二进制文件无法   链接到它,因为找不到它。检查应用程序是否捆绑   使用“始终嵌入Swift”可以正确嵌入Swift标准库   标准库”的构建设置,以及每个使用的二进制文件   Swift拥有正确的嵌入式Swift标准搜索路径   使用“运行路径搜索路径”构建设置的库。

解决方案: 经过数天的调试,对我有用的是从Xcode组织者上载档案后禁用“包括iOS内容的位码” 。似乎此选项修改了导致验证程序失败的二进制文件。

enter image description here

答案 4 :(得分:0)

在我的情况下(Xcode 12.3,链接两个用 Carthage 编译的 XCFrameworks 而没有 Cocoapods)它对我有用:

  1. 为 Main 设置 ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES YES 和观察目标。
  2. 为其他人将 ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES 设置为 NO
  3. 为两个链接的 XCFrameworks 设置 Embed Without Signing

答案 5 :(得分:0)

遇到了同样的问题,但我的情况是因为我将 CocoaPod 添加到我的自定义手表框架中,然后将其链接到手表扩展程序中。我必须将我的 Podfile 更新为

use_frameworks!
target 'MyApp WatchKit Extension' do
    platform :watchos, '4.0'
    target 'MyAppWatchFramework' do
        platform :watchos, '4.0'
        pod 'CocoaLumberjack'
    end
end

然后它终于能够找到图书馆。