Ios 9 and NSAppTransportSecurity

The problem with iOS 9 and the work with the server. Set i info.plist:

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>

When you run the application through Xcode, everything is fine. Work with the server is going fine. But as soon as I stop the application and try to start it, simply by clicking on the icon in the simulator. The network stops working. Same issue when I submit my app in Review in TestFlight. The application is installed, but the network stops working again.

Xcode 7.0 (7a220) iOS 9.0

+4
source share
3 answers

Are you sure it does not work? I tested it and everything is fine.

Possible actions :

, , Xcode , :

App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure.

Xcode . DEVICE_CODE

(Hint: it will be one of these ~/Library/Developer/CoreSimulator/Devices/. The easiest way to find this code from Xcode is to go Window->Devices)

:

~/Library/Logs/CoreSimulator/<DEVICE_CODE>/system.log

( , Xcode , Transport Transport).

, , .

, Xcode.

==================================

.

P.S

NSAllowsArbitraryLoads true, :

<key>NSAppTransportSecurity</key>
<dict>
  <key>NSExceptionDomains</key>
  <dict>
    <key>yourserver.com</key>
    <dict>
      <!--Include to allow subdomains-->
      <key>NSIncludesSubdomains</key>
      <true/>
      <!--Include to allow HTTP requests-->
      <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
      <true/>
      <!--Include to specify minimum TLS version-->
      <key>NSTemporaryExceptionMinimumTLSVersion</key>
      <string>TLSv1.1</string>
    </dict>
  </dict>
</dict>
+4

: Plist Apple

,

NSAppTransportSecurity < -

NSAllowsArbitraryLoads < -

enter image description here

+2

, :

  • .
  • .
  • /.

enter image description here

Note. This problem occurs because your project settings do not allow the default link to any script links for different sites. Therefore, it blocks any service calls that go beyond your application.

0
source

Source: https://habr.com/ru/post/1608094/


All Articles