Please have a look at the following code:
override func viewDidLoad() {
super.viewDidLoad()
let url2 = NSURL (string: "http://leinelab.net/api/spaceapi.json")
let requestObj = NSURLRequest(URL: url2!);
let response: AutoreleasingUnsafeMutablePointer<NSURLResponse?> = nil;
let responseData = (try? NSURLConnection.sendSynchronousRequest(requestObj, returningResponse: response)) as NSData?
let datastring = NSString(data: responseData!, encoding: NSUTF8StringEncoding)
let datastring2 = String(datastring!)
let text = ":true}"
if datastring2.rangeOfString(text) != nil
.
.
.
Somewhere here I have to work with NSURLConnection to access a website with self signed certificates but I don't know how. Code worked under Xcode 6, after upgrading to Xcode 7 it doesn't.
Edit:
This is the error message:
2016-01-22 22:45:56.678 LL-Test[3968:147205] App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file. fatal error: unexpectedly found nil while unwrapping an Optional value (lldb)