0

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.

enter image description here

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?

Xcode fatal

leightski
  • 1,614
  • 1
  • 11
  • 16
Dicky Tsang
  • 6,135
  • 4
  • 20
  • 18

0 Answers0