I am trying to send some data from an array to an other interfaceController. The problem is that I am getting
unexpectedly found nil while unwrapping an Optional value exception
even though the array is not nil. In fact I can even print the result using
print(...).
the problem is that I cannt set this result to a label without getting the exception.
Here is my code to laugh the new interfaceController with context data
@IBAction func lauchInterfaceClick() {
presentControllerWithName("SecondInterface", context: ["hi","how are you"])
}
And then retrieve the results in SecondInterface like below
override func awakeWithContext(context: AnyObject?) {
super.awakeWithContext(context)
// Configure interface objects here.
if context != nil{
let somevalue = context as! [String]
// here is where I getting the exception, in addition to Thread 1: EXC_BAD_INSTRUCTION (code=EXC_i386_INVOP, subcode=0x0)
self.showWat.setText(String(somevalue[0]))
// I have also tried this
// self.showWat.setText(somevalue[0])
}
please note that on the other hand a print(String(somevalue[0]))
outputs hi