[英]info.plist can not be saved after editing in react native
The problem I have is when I edit the MyProject/ios/info.plist , I save it successfully. 我遇到的问题是编辑MyProject / ios / info.plist时 ,成功保存了它。 But when I try to open the project to see if the changes have been applied, it is only edited back to its default form.
但是,当我尝试打开项目以查看是否已应用更改时,只会将其编辑回其默认形式。 Does anyone know why this happens and how could it be definitively edited after adding anything?
有谁知道为什么会发生这种情况,以及添加任何内容后如何对其进行最终编辑? Here you have more details with what I work:
在这里,您对我的工作有更多详细信息:
package.json: package.json:
{ "name": "user", "version": "0.0.1", "private": true, "scripts": { "start": "node node_modules/react-native/local-cli/cli.js start", "test": "jest" }, "dependencies": { "npm": "^5.7.1", "react": "16.3.0-alpha.2", "react-native": "0.54.2" }, "devDependencies": { "babel-jest": "23.0.0-alpha.0", "babel-preset-react-native": "4.0.0", "jest": "22.4.2", "react-test-renderer": "16.3.0-alpha.2" }, "jest": { "preset": "react-native" } }
info.plist before editing (default): 编辑前的info.plist(默认):
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>LastAccessedDate</key> <date>2018-03-20T15:02:01Z</date> <key>WorkspacePath</key> <string>/Users/user/Documents/myproject/ios/myproject.xcodeproj</string> </dict> </plist>
info.plist after editing: 编辑后的info.plist:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>LastAccessedDate</key> <date>2018-03-20T15:02:01Z</date> <key>WorkspacePath</key> <string>/Users/user/Documents/myproject/ios/myproject.xcodeproj</string> </dict> <key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> </dict> </plist>
I explain, when saving the changes made and recompile the application from scratch, the lines added in the info.plist disappear and only the default value remains. 我解释说,当保存所做的更改并从头开始重新编译应用程序时,info.plist中添加的行会消失,仅保留默认值。
However, if there's no solution, what can i add instead of 但是,如果没有解决方案,我可以添加些什么而不是
<key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> </dict>
to make http
requests to IOS devices, is there a different way to do it? 向IOS设备发出
http
请求,是否有其他方法?
There should be only one root level dictionary in the file. 文件中应该只有一个根目录字典。 So try this one instead:
因此,请尝试以下方法:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>LastAccessedDate</key>
<date>2018-03-20T15:02:01Z</date>
<key>WorkspacePath</key>
<string>/Users/user/Documents/myproject/ios/myproject.xcodeproj</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
</dict>
</plist>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.