我可以从cordova插件的plugin.xml修改Xcode Build Settings吗?

时间:2018-02-05 15:42:22

标签: ios xcode cordova plugins

我正在创建一个自定义Cordova插件,需要指定一些自定义Xcode构建设置(例如,CLANG_CXX_LANGUAGE_STANDARD)。

我以为我可以使用cordova-custom-config pluginconfig.xml规范进行设置,如下所示:

 <custom-preference name="ios-XCBuildConfiguration-CLANG_CXX_LANGUAGE_STANDARD" value="gnu++0x" quote="none" buildType="release" /> 
 <custom-preference name="ios-XCBuildConfiguration-CLANG_CXX_LANGUAGE_STANDARD" value="gnu++0x" quote="none" buildType="debug" /> 
 <custom-preference name="ios-XCBuildConfiguration-CLANG_CXX_LIBRARY" value="libc++" quote="none" buildType="release" /> 
 <custom-preference name="ios-XCBuildConfiguration-CLANG_CXX_LIBRARY" value="libc++" quote="none" buildType="debug" /> 
 <custom-preference name="ios-XCBuildConfiguration-GCC_C_LANGUAGE_STANDARD" value="gnu99" quote="none" buildType="release" /> 
 <custom-preference name="ios-XCBuildConfiguration-GCC_C_LANGUAGE_STANDARD" value="gnu99" quote="none" buildType="debug"/> 

但是,在使用plugman install安装插件时,不会应用这些插件。

有关如何从Cordova插件修改Xcode Build Settings的任何建议吗?感谢

1 个答案:

答案 0 :(得分:0)

您可以将构建标志添加到build.json

{
    "ios": {
        "debug": {
            "codeSignIdentity": "iPhone Developer",
            "developmentTeam": "FG35JLLMXX4A",
            "packageType": "development",
            "buildFlag": [
                "EMBEDDED_CONTENT_CONTAINS_SWIFT = YES",
                "ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES=NO",
                "LD_RUNPATH_SEARCH_PATHS = \"@executable_path/Frameworks\""
            ]
        },
        "release": {
            "codeSignIdentity": "iPhone Developer",
            "developmentTeam": "FG35JLLMXX4A",
            "packageType": "app-store",
            "buildFlag": [
                "EMBEDDED_CONTENT_CONTAINS_SWIFT = YES",
                "ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES=NO",
                "LD_RUNPATH_SEARCH_PATHS = \"@executable_path/Frameworks\""
            ]
        }
    }
}

https://cordova.apache.org/docs/en/latest/guide/platforms/ios/#using-buildjson