选择 Info.plist 默默地失败了——可能是什么原因?

Choosing Info.plist fails silently -- what can be the reason?

我们开发了一个 iOS 框架,主要在 Swift 中,并带有一些 Objective-C。

在某个地方,我们显然失去了项目之间的联系。它的主要目标及其 Info.plist:

这是在主要目标上。我们只注意到当构建的框架不包含 Info.plist 时,一个快速绘制的用于玩弄我们的框架的模拟应用程序根本不喜欢它。

但是,选择文件失败。我可以 select 此对话框中的文件:

但是用"Choose"确认没有任何作用。在 pbxproj 文件中,我看到像

这样的条目
    <hash> /* Debug */ = {
        isa = XCBuildConfiguration;
        buildSettings = {
            ...
            DEFINES_MODULE = YES;
            ...
            INFOPLIST_FILE = "$(SRCROOT)/hcl/Info.plist";
            "INFOPLIST_FILE[sdk=*]" = "";
            INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
            IPHONEOS_DEPLOYMENT_TARGET = 10.2;
            ...
        };
        name = Debug;
    };

这似乎完全合理。 Info.plist 文件本身似乎也是有效的; XCode 打开时很高兴显示 table 视图。

但是,“信息”选项卡仍然是空的,并且没有 Info.plist 出现在框架中。 将项目设置的 "Packaging" 部分中的 "Info.plist file" 设置为同一路径也无济于事。

这可能是什么原因?我们怎样才能让 Info.plist 进入我们的框架?


"Fun" 旁注:我试图通过将 Info.plist 添加到 "Build phases" 的 "Copy Bundle Resources" 部分来解决这个问题。果然,我们在framework中得到了Info.plist,using app就满意了。然而,我们的测试不再运行:

xctest[7779:90709] The bundle “hclTests” couldn’t be loaded because it is damaged 
    or missing necessary resources. 
Try reinstalling the bundle.

xctest[7779:90709] (dlopen_preflight(/path/to/hclTests): 
    Library not loaded: @rpath/hcl.framework/hcl
    Referenced from: /path/to/Build/Products/Debug-iphonesimulator/hclTests.xctest/hclTests
    Reason: no suitable image found.  Did find:
        /path/to/Build/Products/Debug-iphonesimulator/hcl.framework/hcl: 
            required code signature missing for 
            '/path/to/Build/Products/Debug-iphonesimulator/hcl.framework/hcl'

/path/to/Build/Products/Debug-iphonesimulator/hcl.framework/hcl: 
    required code signature missing for '/path/to/Build/Products/Debug-iphonesimulator/hcl.framework/hcl'

Program ended with exit code: 82

感谢这条非常有用的消息,XCode。我只花了三个小时就弄清楚了一个复制的文件导致了这个。

有一个构建设置:

"INFOPLIST_FILE[sdk=*]" = "";

不知道从哪里来的,好像覆盖了

INFOPLIST_FILE = "module/Info.plist"

并造成无声的混乱。

删除以上设置即可解决问题。