[Vuejs]-How to allow an app to access internet on ios?

3πŸ‘

βœ…

One possible problem is ATS you can read here

What you need to do is adding the following snippet into app/App_Resources/iOS/Info.plist.
There is a <dict> tag in there with a lot of content in it. All you need to do is putting this inside that <dict>

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

So you will get something like:

<?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>
    # snippet goes here
    .
    .
    .
    </dict>
</plist>

You also need to do this if your server is using a self-signed certificate.

πŸ‘€m1sh0

1πŸ‘

Problem was gone after editing Info.plist file that allow specific domains rather than all domains. and I heard that if you trying upload your app in app store it will be rejected in iOS 10 + if you allow all http domains.

Here is my App Transport Security

<key>NSAppTransportSecurity</key>
    <dict>
        <key>NSExceptionDomains</key>
            <dict>
                <key>specificDomain.com</key>
                <dict>
                    <key>NSIncludesSubdomains</key>
                    <true/>
                    <key>NSExceptionAllowsInsecureHTTPLoads</key>
                    <true/>
                    <key>NSExceptionRequiresForwardSecrecy</key>
                    <false/>
                </dict>
            </dict>
        <key>NSAllowsLocalNetworking</key>
        <true/>
    </dict>
πŸ‘€Max Kim

Leave a comment