對於我的應用程序,我需要爲iOS的Info.plist文件添加一些設置。我認爲最好的方法是將這些設置添加到我的config.xml文件中(我使用的是PhoneGap)。當我添加以下到config.xml文件並運行PhoneGap:修改config.xml以添加屬性到Info.plist iOS
cordova build ios
或
cordova update platform ios
沒有被添加到我的Info.plist文件,我絕對不知道這是爲什麼。編譯顯示'成功',所以我不認爲有語法錯誤。
我已經試過:
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
<config-file target="*-Info.plist" parent="NSAppTransportSecurity">
<array>
<dict>
<key>NSExceptionDomains</key>
<array>
<dict>
<key>s3.amazonaws.com</key>
<array>
<dict>
<!--Include to allow subdomains-->
<key>NSIncludesSubdomains</key>
<true/>
<!--Include to allow insecure HTTP requests-->
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
<!--Include to specify minimum TLS version-->
<key>NSTemporaryExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
</dict>
</array>
</dict>
</array>
</dict>
</array>
</config-file>
</platform>
而且
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
<config-file target="*-Info.plist" parent="NSAppTransportSecurity">
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>s3.amazonaws.com</key>
<dict>
<!--Include to allow subdomains-->
<key>NSIncludesSubdomains</key>
<true/>
<!--Include to allow insecure HTTP requests-->
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
<!--Include to specify minimum TLS version-->
<key>NSTemporaryExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
</dict>
</dict>
</dict>
</config-file>
</platform>
而且
<gap:config-file platform="ios" parent="NSAppTransportSecurity">
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>s3.amazonaws.com</key>
<dict>
<!--Include to allow subdomains-->
<key>NSIncludesSubdomains</key>
<true/>
<!--Include to allow insecure HTTP requests-->
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
<!--Include to specify minimum TLS version-->
<key>NSTemporaryExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
</dict>
</dict>
</dict>
</gap:config-file>
而且
<gap:config-file platform="ios" parent="NSAppTransportSecurity">
<array>
<dict>
<key>NSExceptionDomains</key>
<array>
<dict>
<key>s3.amazonaws.com</key>
<array>
<dict>
<!--Include to allow subdomains-->
<key>NSIncludesSubdomains</key>
<true/>
<!--Include to allow insecure HTTP requests-->
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
<!--Include to specify minimum TLS version-->
<key>NSTemporaryExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
</dict>
</array>
</dict>
</array>
</dict>
</array>
</gap:config-file>
但是沒有任何內容添加到Info.plist文件中。我在這裏做錯了什麼?
[通過Cordova config.xml添加條目到iOS .plist文件]的可能重複(http://stackoverflow.com/questions/22769111/add-entry-to-ios-plist-file-via-cordova-config -xml) – lifeisfoo