【问题标题】:Choosing Info.plist fails silently -- what can be the reason?选择 Info.plist 静默失败——可能是什么原因?
【发布时间】:2017-03-14 09:49:15
【问题描述】:

我们开发了一个 iOS 框架,主要使用 Swift 和一些 Objective-C。

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

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

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

但是用“选择”确认没有任何效果。在 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 时,它​​会愉快地显示表格视图。

但是,Info 选项卡仍然为空,并且框架中没有 Info.plist。 将项目设置的“打包”部分中的“Info.plist 文件”设置为相同的路径也无济于事。

这可能是什么原因?我们如何才能将 Info.plist 放入我们的框架中?


“有趣”旁注:我尝试通过将 Info.plist 添加到“构建阶段”的“复制捆绑资源”部分来解决此问题。果然,我们拿到了框架中的Info.plist,使用的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。我只花了三个小时就弄清楚了复制的文件导致了这个问题。

【问题讨论】:

    标签: ios xcode build info.plist


    【解决方案1】:

    有一个构建设置:

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

    我不知道它来自哪里,但它似乎覆盖了

    INFOPLIST_FILE = "module/Info.plist"
    

    并造成无声的混乱。

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-02-24
      • 1970-01-01
      • 1970-01-01
      • 2019-06-23
      • 2020-05-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多