This seems like it should be so simple - I have researched and looked and tried different things and just can't figure it out. I have a view controller which allows a user to enter their own review of a winery. Its a modal view from a detail winery page - I am simply trying to populate a Label in this modal view with the winery name from the previous view. (then saving the winery name and the users review) the review part worked fine - its transferring the name over that is giving me fits crashing on me with "Swift Dynamic Cast Failed" Any help is greatly appreciated see code:
"review" view controller:
import UIKit
import CoreData
class MyReviewViewController: UIViewController {
var myreview:wineryReview!
var passName:String!
@IBOutlet weak var wineryNameLabel:UILabel!
@IBOutlet weak var myReview:UITextView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
wineryNameLabel.text = passName
the code of the passing tableviewcontroller:
var wineryNames = "Glenora Wine Cellars"
(because I am just testing functionaility the variable is just simply called) in the class
// MARK: - Navigation
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) {
if segue.identifier == "mapWinery" {
let mvc = segue.destinationViewController as WineryMapViewController
mvc.wineryMap = wineryAddress
}
if segue.identifier == "goToMyReview" {
let mrvc = segue.destinationViewController as MyReviewViewController
mrvc.passName = wineryNames
}
}
Error:
libswiftCore.dylib swift_dynamicCastClassUnconditional:
0x103450860: pushq %rbp
0x103450861: movq %rsp, %rbp
0x103450864: testq %rdi, %rdi
0x103450867: je 0x10345089e ; swift_dynamicCastClassUnconditional + 62
0x103450869: movabsq $-0x7fffffffffffffff, %rax
0x103450873: testq %rax, %rdi
0x103450876: jne 0x10345089e ; swift_dynamicCastClassUnconditional + 62
0x103450878: leaq 0xb52e9(%rip), %rax
0x10345087f: movq (%rax), %rax
0x103450882: andq (%rdi), %rax
0x103450885: nopw %cs:(%rax,%rax)
0x103450890: cmpq %rsi, %rax
0x103450893: je 0x1034508ad ; swift_dynamicCastClassUnconditional + 77
0x103450895: movq 0x8(%rax), %rax
0x103450899: testq %rax, %rax
0x10345089c: jne 0x103450890 ; swift_dynamicCastClassUnconditional + 48
0x10345089e: leaq 0x36b7d(%rip), %rax ; "Swift dynamic cast failed"
0x1034508a5: movq %rax, 0xb4c0c(%rip) ; gCRAnnotations + 8
0x1034508ac: int3
0x1034508ad: movq %rdi, %rax
0x1034508b0: popq %rbp
0x1034508b1: retq
0x1034508b2: nopw %cs:(%rax,%rax)