Ios 修复错误->&引用;无法强制转换类型为';SecondViewController';至';FirstViewController'&引用;

Ios 修复错误->&引用;无法强制转换类型为';SecondViewController';至';FirstViewController'&引用;,ios,swift,uitabbarcontroller,uistoryboard,Ios,Swift,Uitabbarcontroller,Uistoryboard,今天我拆开了我的故事板,现在我遇到了一个错误,我不知道如何修复它 我有一个故事板(产品),其中包含第一个选项卡中的所有UIViewController,还有一个故事板(购物车),其中包含第二个选项卡中的所有UIViewController。 我已经将情节提要入口点设置为所有导航控制器,我在主情节提要中设置了引用,我为每个情节提要引用设置了正确的情节提要目标,我真的不知道我做错了什么 以下是启动应用程序时出现的错误: "Could not cast value of type 'ShoppingL

今天我拆开了我的故事板,现在我遇到了一个错误,我不知道如何修复它

我有一个故事板(产品),其中包含第一个选项卡中的所有UIViewController,还有一个故事板(购物车),其中包含第二个选项卡中的所有UIViewController。 我已经将情节提要入口点设置为所有导航控制器,我在主情节提要中设置了引用,我为每个情节提要引用设置了正确的情节提要目标,我真的不知道我做错了什么

以下是启动应用程序时出现的错误:

"Could not cast value of type 'ShoppingLand.CartViewController' (0x10d72a780) to 'ShoppingLand.ProductsViewController' (0x10d72a8c0)."
这是我的函数,其中正在崩溃(在第一行崩溃):

以下是我的故事板图片:


谢谢你抽出时间

在使用拖放交换这两个图标后,我在一秒钟内修复了此错误。


谢谢你抽出时间

看起来像是
let firstTabVC=((self.tabBarController?.viewControllers![0]作为!UINavigationController)。viewControllers[0])
实际上返回了一个
CartViewController
// Append the selectedProducts into productsInCartArray using the TabBarController
    func fetchSelectedProducts() {
        let firstTabVC = ((self.tabBarController?.viewControllers![0] as! UINavigationController).viewControllers[0] as! ProductsViewController)
        productsInCartArray = firstTabVC.selectedProductsArray
        productPricesArray = firstTabVC.priceForSelectedProductsArray
        getProductsPhotosArray = firstTabVC.googlePhotosArray
        totalSum = productPricesArray.reduce(0, +)
    }