In Xcode 6.3 beta running Swift 1.2 I have seemingly successfully retrieved a JSON object from an API, but the debugger is claiming that the object has no properties. The API is running on localhost and is called like this:
NSURLConnection.sendAsynchronousRequest( request, queue: queue,
completionHandler: completionHandler )
completionHandler
is a closure with a breakpoint in it:
let completionHandler =
{
( response: NSURLResponse!, data: NSData!, error: NSError! ) -> Void in
// BREAKPOINT HERE
}
The debugger shows that in Xcode 6.3 beta with Swift 1.2 data: NSData! is an ObjectiveC.NSObject of 190 bytes but with no properties, which seems flatly contradictory. I simply want the JSON data that I hope is hidden somewhere in those bytes. I do not know whether the debugger, or code that needs updating for Swift 1.2, or my understanding of things, or something else is to blame. I simply want the JSON.
Post-script
The JSON data was there all along, as the byte count suggested, and getting it was very simple (using SwiftyJSON):
let json = JSON( data: data )
Quite what has happened to the properties in the Xcode 6.3 beta debugger remains a mystery though. I'm not adding this as an answer to my own question, because whilst it works it might not necessarily be the answer. I am too new to Swift to know what the actual answer might be, or even if there is one.