2

The code I was using for Xcode 6.4 to open a uiwebview doesn't load for Xcode 7 when starting simulator.

class ViewController: UIViewController {

@IBOutlet var webLaundry: UIWebView!


func loadWebPage(){
    let theURL = "http://www.google.com"
    let theRequestURL = NSURL (string: theURL)
    let theRequest = NSURLRequest (URL: theRequestURL!)
    webLaundry.loadRequest(theRequest)
}

override func viewDidLoad() {
    super.viewDidLoad()
    loadWebPage()
    // Do any additional setup after loading the view, typically from a nib.
}

What should I change to fix this issue?

Drew Bennett
  • 483
  • 3
  • 6
  • 25

1 Answers1

4

That is apple's new security requirement. app transport security in iOS 9 .

What you will need to do is:

  1. in xcode 7 , in your project , find " Info.plist" , right click , open as " source code " .

  2. put words below between last and

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

  1. run your project
  2. Source
Jorge Y. C. Rodriguez
  • 3,394
  • 5
  • 38
  • 61
Richard Mao
  • 202
  • 3
  • 12