You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have this sample use case where I have a JSON-like NSDictionary but I want to put some random NSData to prove that I can add something like a small UIImage/Audio file into CBOR.
func test_2_encodeMap_2(){// begin generating some random NSDataletlength=2048letbytes=[UInt32](repeating:0, count: length).map{ _ inarc4random()}letdata=Data(bytes: bytes, count: length)// end generating some random NSDataletjson:NSDictionary=["_id":"123abc","color":"Red","age":56,"mileage": 56.444,"tags":["a","b","d",4],"data": data
]varencoded=CBOR.encode(json asNSDictionary)vardecoded=CBOR.decode(encoded!)as!NSDictionary}
It encodes fine but crashes saying "Thread 1: Fatal error: Array index is out of range" at Decoder.swift on Line 77
What am I doing wrong?
The text was updated successfully, but these errors were encountered:
mbalex99
changed the title
Problem with NSData
Problem with NSData as Value when Decoding
Apr 1, 2019
I have this sample use case where I have a JSON-like
NSDictionary
but I want to put some random NSData to prove that I can add something like a small UIImage/Audio file into CBOR.It encodes fine but crashes saying
"Thread 1: Fatal error: Array index is out of range"
at Decoder.swift on Line 77What am I doing wrong?
The text was updated successfully, but these errors were encountered: