0

All posts & tutorials which i accessed, gives the solution to edit the info.plist file, & i did the same.

Editing plist file works for google.co.in But does not work for https://www.onlinesbi.com

I just want to know my mistake Please guide.

My info.plist

    <?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>CFBundleExecutable</key>
    <string>$(EXECUTABLE_NAME)</string>
    <key>CFBundleIdentifier</key>
    <string>com.abcd.abcdAppstore.$(PRODUCT_NAME:rfc1034identifier)</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>$(PRODUCT_NAME)</string>
    <key>CFBundlePackageType</key>
    <string>BNDL</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleVersion</key>
    <string>1</string>
    <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSExceptionDomains</key>
        <dict>
            <key>www.onlinesbi.com</key>
            <dict>
                <key>NSTemporaryExceptionRequiresForwardSecrecy</key> <false/>
                <!--Include to allow subdomains-->
                <key>NSIncludesSubdomains</key>
                <true/>
                <!--Include to allow insecure HTTP requests-->
                <key>NSExceptionAllowsInsecureHTTPLoads</key>
                <true/>
                <!--Include to specify minimum TLS version-->
                <key>NSExceptionMinimumTLSVersion</key>
                <string>TLSv1.2</string>
            </dict>
        </dict>
    </dict>
    </dict>
</plist>

My ViewController

    private var URL = "https://www.onlinesbi.com"
override func viewDidLoad() {
        super.viewDidLoad()
let url = NSURL (string: URL);
            let requestObj = NSURLRequest(URL: url!);
            myWebview.loadRequest(requestObj);
}//viewDidLoad closes here....

EDIT

I tried updating my info.plist to :

<?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>CFBundleExecutable</key>
    <string>$(EXECUTABLE_NAME)</string>
    <key>CFBundleIdentifier</key>
    <string>com.abcd.abcdAppstore.$(PRODUCT_NAME:rfc1034identifier)</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>$(PRODUCT_NAME)</string>
    <key>CFBundlePackageType</key>
    <string>BNDL</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleVersion</key>
    <string>1</string>
    <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSExceptionDomains</key>
        <dict>
            <key>onlinesbi.com</key>
            <dict>
                <key>NSIncludesSubdomains</key>
                <true/>
                <key>NSExceptionAllowsInsecureHTTPLoads</key>
                <true/>
                <key>NSExceptionRequiresForwardSecrecy</key>
                <true/>
                <key>NSExceptionMinimumTLSVersion</key>
                <string>TLSv1.2</string>
                <key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
                <false/>
                <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
                <true/>
                <key>NSThirdPartyExceptionMinimumTLSVersion</key>
                <string>TLSv1.2</string>
                <key>NSRequiresCertificateTransparency</key>
                <false/>
            </dict>
        </dict>
    </dict>
</dict>
</plist>

But still the web view is empty. :-(

Also i tried to edit the Developer option of my Simulator but didn't succeed.

Any help will be appreciated. Thanks in advance

Pawan
  • 533
  • 1
  • 7
  • 31
  • I also get same type error 2016-02-16 23:46:28.598 sslcMerchant[2982:314081] CFNetwork SSLHandshake failed (-9824) 2016-02-16 23:46:28.598 sslcMerchant[2982:314082] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9824) – matinict Feb 16 '16 at 17:48
  • @matinict I am still stuck at this point. I don't know why !! **https://www.google.co.in works** but **https://onlinesbi.co.in does not works**. There could be some certificate issue !! If we could exactly know the certificate issue then atleast we can fix this in our projects. :-( – Pawan Feb 18 '16 at 04:37

3 Answers3

0

info.plist as below or just copy & past that work for me up to iOS 9.2

<?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>NSAppTransportSecurity</key>
        <dict>
            <key>NSAllowsArbitraryLoads</key>
            <true/>
        </dict>

    <key>CFBundleDevelopmentRegion</key>
    <string>en</string>
    <key>CFBundleExecutable</key>
    <string>$(EXECUTABLE_NAME)</string>
    <key>CFBundleIdentifier</key>
    <string>$(PRODUCT_BUNDLE_IDENTIFIER)</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>UIMainStoryboardFile</key>
    <string>Main</string>
    <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>
</dict>
</plist>
matinict
  • 2,411
  • 2
  • 26
  • 35
  • No its not working :-( I added this code : NSAppTransportSecurity NSAllowsArbitraryLoads – Pawan Feb 19 '16 at 07:19
  • It is just displaying a white screen, No exceptions are printed as Logs. – Pawan Feb 19 '16 at 07:20
  • 1
    I made a new project & did the same code, it was working perfectly correct. I think the issue was with the Xcode & iOS version upgradation. Thanks, for all your support (+1). – Pawan Feb 19 '16 at 10:32
0

Finally got the answer as:

  1. I had started my code on Xcode 6.x & iOS version 7.x, but after some time i upgraded my Xcode to Xcode 7.x & iOS version 9.x. So the Xcode automatically did some changes. In these automatic changes, something wrong happened & UIWebview started working weird.

  2. How did i conclude at above point ?? Ans: I made a new project on Xcode 7.x & iOS 9.x then the code was running correctly.

  3. What is the final info.plist?


As matinict suggested,

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

worked for me.

Just i kept it at the end & not at the start.

Pawan
  • 533
  • 1
  • 7
  • 31
-1

I was facing this issue lately, and the answers posted here didn´t work for me... but i found a different solution by doing this at the AppDelegate (Swift)

extension NSURLRequest {
static func allowsAnyHTTPSCertificateForHost(host: String) -> Bool {
    return true
}}

I hope it helps someone.

VaroX
  • 430
  • 4
  • 17