在Info.plist上添加任意加载后,NativeScript上的Http请求无法正常工作

时间:2017-01-11 23:29:38

标签: ios http angular typescript nativescript

我开始使用NativeScript,实际上我正在做快速入门。

我读了一个类似的问题,它必须启用来自Info.plist的http请求,这是文件的内容:

<?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>CFBundleDevelopmentRegion</key>
    <string>en</string>
    <key>CFBundleDisplayName</key>
    <string>Groceries</string>
    <key>CFBundleExecutable</key>
    <string>${EXECUTABLE_NAME}</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>${PRODUCT_NAME}</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleVersion</key>
    <string>1.0</string>
    <key>LSRequiresIPhoneOS</key>
    <true/>
    <key>UILaunchStoryboardName</key>
    <string>LaunchScreen</string>
    <key>UIRequiresFullScreen</key>
    <true/>
    <key>UIRequiredDeviceCapabilities</key>
    <array>
        <string>armv7</string>
    </array>
    <key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>UISupportedInterfaceOrientations~ipad</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationPortraitUpsideDown</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>UIViewControllerBasedStatusBarAppearance</key>
    <false/>
    <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key>
        <true/>
        <key>NSExceptionDomains</key>
        <dict>
            <key>api.everlive.com</key>
            <string></string>
        </dict>
    </dict>
</dict>
</plist>

文件屏幕: enter image description here

但是,当我运行应用程序时,只是不在iOS平台上工作:  enter image description here

这是控制台输出:

CONSOLE LOG file:///app/shared/user/user.service.ts:50:20: {"line":40,"column":37,"sourceURL":"file:///app/tns_modules/http/http-request.js"}

据说应用程序应该使用Info.plist中添加的行,任何关于我做错的想法。

1 个答案:

答案 0 :(得分:0)

  

看起来iOS不支持这种仅连接Android的连接   确实:

     
      
  • ${variable}/some-data
  •   
     

在http请求中,必须以classic方式执行:

     
      
  • 可变+ '/一些数据'
  •