我已经写了这个程序来获取NSArray
的ios swift
数据。除了所需的数据外,为什么我在输出中的垃圾值如此之低?为什么这个垃圾数据与输出一起出现?
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
data = dataOfJson("http://192.168.1.8:8888/service.php")
println(data)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
//Dispose of any resources that can be recreated.
}
func dataOfJson(url: String) -> NSArray {
var urla = NSURL(string: url)
var data:NSData = NSData(contentsOfURL: urla!)!
println(data)
return (NSJSONSerialization.JSONObjectWithData(data, options: nil, error: nil) as! NSArray)
}
输出:
<5b7b224e 616d6522 3a225361 67617222 2c224164 64726573 73223a22 31305c2f 35352053 616e746f 73682070 61726b22 2c224c61 74697475 6465223a 2234332e 34353434 34222c22 4c6f6e67 69747564 65223a22 2d313232 2e343532 3435227d 2c7b224e 616d6522 3a225375 72616a22 2c224164 64726573 73223a22 62343032 20766172 64616e20 746f7765 72222c22 4c617469 74756465 223a2234 352e3331 3434222c 224c6f6e 67697475 6465223a 22353433 2e343532 3334227d 2c7b224e 616d6522 3a224261 64657061 7061222c 22416464 72657373 223a224d 6f756e74 20616275 222c224c 61746974 75646522 3a223630 2e343532 33222c22 4c6f6e67 69747564 65223a22 3435342e 3435227d 5d>
(
{
Address = "10/55 Santosh park";
Latitude = "43.45444";
Longitude = "-122.45245";
Name = Sagar;
},
{
Address = "b402 vardan tower";
Latitude = "45.3144";
Longitude = "543.45234";
Name = Suraj;
},
{
Address = "Mount abu";
Latitude = "60.4523";
Longitude = "454.45";
Name = Badepapa;
}
)
你的意思是第一部分?推测来自'dataOfJson'中的'println(data)'。它看起来只是来自请求的二进制数据。我很困惑你对什么感到困惑... –
那些十六进制数据以上他Json值之间<........> –