Ios ode>Remove:NSAppTransportSecurity就在add语句之前,它将首先删除NSAppTransportSecurity,然后添加它。这不会使任何东西崩溃。节点plist库在解析我的plist文件时遇到一些问题,因此我无法使用此解决方
Ios ode>Remove:NSAppTransportSecurity就在add语句之前,它将首先删除NSAppTransportSecurity,然后添加它。这不会使任何东西崩溃。节点plist库在解析我的plist文件时遇到一些问题,因此我无法使用此解决方,ios,cordova,phonegap-plugins,cordova-3,cordova-plugins,Ios,Cordova,Phonegap Plugins,Cordova 3,Cordova Plugins,ode>Remove:NSAppTransportSecurity就在add语句之前,它将首先删除NSAppTransportSecurity,然后添加它。这不会使任何东西崩溃。节点plist库在解析我的plist文件时遇到一些问题,因此我无法使用此解决方案,而选择了James',它使用了Mac上包含的PListBuddy可执行文件。如果plist库更可靠,这是一个很好的解决方案。我确实按照您的建议从config.xml文件中引用了我的脚本。很好!不需要使用任何额外的插件和作品像一个魅力!对于这
ode>Remove:NSAppTransportSecurity就在add语句之前,它将首先删除NSAppTransportSecurity,然后添加它。这不会使任何东西崩溃。节点
plist
库在解析我的plist文件时遇到一些问题,因此我无法使用此解决方案,而选择了James',它使用了Mac上包含的PListBuddy可执行文件。如果plist
库更可靠,这是一个很好的解决方案。我确实按照您的建议从config.xml
文件中引用了我的脚本。很好!不需要使用任何额外的插件和作品像一个魅力!对于这样一个简单的问题,所有其他解决方案似乎都过时了,或者变得复杂了。plist npm模块严重损坏。当源文件包含空值时,它将生成无效的.plist文件。改用简单的plist。我在添加本地插件时遇到了很多麻烦cordova@8,这个解决方案在我的情况下工作得更好,而且更简单。我在hooks/after\u platform\u add
目录中用这段代码编写了一个补丁。但我的plist文件中仍然有NSMainNibFileNSMainNibFile~ipad
。你知道我怎样才能解决这个问题吗?这对我不起作用。我尝试添加上面的内容,但在我的plist中没有任何更改尝试通过首先将plist放在根目录中来缩小原因?不幸的是,据我所知,此功能会无声地失败。CAMERA\u USAGE\u描述会传递给NSCamerauseSacheDescription。如果要为NSPhotoLibraryUsageDescription添加值,还需要添加
如果使用PhoneGap构建服务,这是设置这些值的推荐方法。我必须在nsCamerauseComiption
的键下方添加随机相机使用文本
,才能接受我的构建。配置没有为任何迟到的人添加文本,项目plist中的设置值现在为。edit config
假设目标已存在于plist中。需要明确的是,如果要添加新的键/字符串对,则应使用config file
,这将在模式
属性的xml树中添加新的子项,我使用了overwrite
而不是merge
,然后运行cordova prepare ios
,成功地将我的config.xml
文件的edit config
标记应用于我的xCode项目的示例信息.plist
。
<platform name="ios">
<config-file target="*-Info.plist" parent="CFBundleURLTypes">
<array>
<dict>
<key>GDLibraryMode</key>
<string>GDEnterpriseSimulation</string>
</dict>
</array>
</config-file>
</platform>
"*-Info.plist": {
"parents": {
"CFBundleDisplayName": [
{
"xml": "<string>RevMob Ads Cordova Plugin Demo</string>",
"count": 1
}
]
}
}
<config-file platform="ios" target="*-Info.plist" parent="UIFileSharingEnabled">
<true/>
</config-file>
npm install -g cordova
cordova platform add ios
<key>UIFileSharingEnabled</key>
<true/>
<platform name="ios">
<config-file target="*/Resources/MyResources.bundle/Info.plist" parent="MyDistribution">
<string>Cordova</string>
</config-file>
<config-file target="*/Resources/MyResources.bundle/Info.plist" parent="MyVersion">
<string>3.2.0</string>
</config-file>
</platform>
<key>NSMainNibFile</key>
<string></string>
<key>NSMainNibFile~ipad</key>
<string></string>
<key>NSMainNibFile</key>
<string>NSMainNibFile~ipad</string>
obj.NSMainNibFile = '';
obj['NSMainNibFile~ipad'] = '';
var fs = require('fs'); // nodejs.org/api/fs.html
var plist = require('plist'); // www.npmjs.com/package/plist
var FILEPATH = 'platforms/ios/***/***-Info.plist';
module.exports = function (context) {
var xml = fs.readFileSync(FILEPATH, 'utf8');
var obj = plist.parse(xml);
obj.GDLibraryMode = 'GDEnterpriseSimulation';
obj.NSMainNibFile = '';
obj['NSMainNibFile~ipad'] = '';
xml = plist.build(obj);
fs.writeFileSync(FILEPATH, xml, { encoding: 'utf8' });
};
<platform name="ios">
<hook type="before_build" src="scripts/my-hook.js" />
</platform>
<plugin name="cordova-plugin-camera" spec="~2.3.0">
<variable name="CAMERA_USAGE_DESCRIPTION" value="My App would like to access your camera, to take photos of your documents." />
</plugin>
<key>NSCameraUsageDescription</key>
<string/>
<key>NSPhotoLibraryUsageDescription</key>
<string/>
<!-- ios -->
<platform name="ios">
<config-file target="*-Info.plist" parent="NSLocationWhenInUseUsageDescription">
<string></string>
</config-file>
<config-file target="*-Info.plist" parent="NSCameraUsageDescription">
<string></string>
</config-file>
<config-file target="*-Info.plist" parent="NSPhotoLibraryUsageDescription">
<string></string>
</config-file>
</platform>
<platform name="ios">
<edit-config file="*-Info.plist" mode="merge" target="NSLocationWhenInUseUsageDescription">
<string>Location is required so we can show you your nearby projects to support.</string>
</edit-config>
<edit-config file="*-Info.plist" mode="merge" target="NSCameraUsageDescription">
<string>Camera accesss required in order to let you select profile picture from camera.</string>
</edit-config>
<edit-config file="*-Info.plist" mode="merge" target="NSPhotoLibraryUsageDescription">
<string>Photo library accesss required in order to let you select profile picture from gallery / library.</string>
</edit-config>
</platform>
<platform name="ios">
<edit-config file="*-Info.plist" mode="merge" target="NSMicrophoneUsageDescription">
<string>My awesome app wish to hear your awesome voice through Microphone. Not for fancy stuff, just want to hear you.</string>
</edit-config>
<edit-config file="*-Info.plist" mode="merge" target="---Key configuration---">
<string>---string value---</string>
</edit-config>
</platform>
cordova platform rm ios
cordova platform add ios
./platform/ios/[your app name]/[your app name]-Info.plist