App Transport Security Exceptions IOS9

2019-07-11 21:17发布

问题:

I am writing an IOS9 app which uses flickr.

Flicker uses an url format of https://farm{farm-id}.staticflickr.com/

The farm id is a number

In my info.plist I have defined whitelisted domains NSAppTransportSecurity - NSExceptionDomains

How can I define these for the farm id as a wild card?

Currently I just did farm1.staticflickr.com farm2.staticflickr.com......up till 9 but I am unsure how far flickr goes.

回答1:

Add an exception for staticflickr.com and in that exception add a key called NSIncludesSubdomains and set it to true.

<key>NSAppTransportSecurity</key>
    <dict>      
        <key>NSExceptionDomains</key>
        <dict>
            <key>staticflickr.com</key>
            <dict>
                <key>NSIncludesSubdomains</key>
                <true/>
            </dict>         
        </dict>
    </dict>


标签: ios flickr ios9