I made a small demo to request and decode data using a restful API, the API URL is:
http://interface.bilibili.tv/playurl?cid=1168445&otype=json
This is an API of video URLs, I wrote and ran the code below in playgrounds:
import UIKit
var url = NSURL(string: "http://api.bilibili.tv/view?type=json&id=822920&batch=1&appkey=0a99fa1d87fdd38c")
var data = NSData.dataWithContentsOfURL(url, options: NSDataReadingOptions.DataReadingUncached, error: nil)
var json : AnyObject! = NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.AllowFragments, error: nil)
And then in Xcode, it exits automatically every time. But if I change the URL to:
http://freegeoip.net/json/8.8.8.8
The code runs without problems.
I will appreciate if anyone can help me, is this a bug of Xcode 6 beta or is there something wrong with my written code?