Skip to content

Instantly share code, notes, and snippets.

@drd
Created September 1, 2014 06:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drd/b8429e849b5a2d7dda84 to your computer and use it in GitHub Desktop.
Save drd/b8429e849b5a2d7dda84 to your computer and use it in GitHub Desktop.
where is the bug?
func testOMGWTF() {
var err: NSError?
let plist = [
"a": "c",
// note that 1 is a String
"b": "1"
]
let data = NSPropertyListSerialization.dataWithPropertyList(
plist,
format: NSPropertyListFormat.BinaryFormat_v1_0,
options: 0,
error: nil)
if let properties = NSPropertyListSerialization.propertyListWithData(
data,
options: 0,
format: nil,
error: &err) as? NSDictionary {
println("heyo")
} else {
XCTFail(err!.description)
}
func testOMGWTF() {
var err: NSError?
let plist = [
"a": "c",
// making this an Int is the difference
"b": 1
]
let data = NSPropertyListSerialization.dataWithPropertyList(
plist,
format: NSPropertyListFormat.BinaryFormat_v1_0,
options: 0,
error: nil)
if let properties = NSPropertyListSerialization.propertyListWithData(
data,
options: 0,
format: nil,
error: &err) as? NSDictionary {
println("heyo")
} else {
XCTFail(err!.description)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment