真的难倒 - Swift Dynamic Cast在尝试在ViewControllers之间移动数据时失败了

时间:2015-02-03 00:53:20

标签: swift segue viewcontroller

这看起来应该是这么简单 - 我已经研究过,看过并尝试了不同的东西,但却无法弄明白。我有一个视图控制器,允许用户输入他们自己的酒厂评论。它是一个详细的酿酒厂页面的模态视图 - 我只是尝试使用上一个视图中的酿酒厂名称填充此模态视图中的标签。 (然后保存酒厂的名称和用户评论)审查部分工作正常 - 它将名称转移到那个让我适应崩溃与#34; Swift Dynamic Cast Failed"非常感谢任何帮助,请参阅代码:

"综述"查看控制器:

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

传递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
    }

}

错误:

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)

0 个答案:

没有答案