【发布时间】:2020-04-17 21:27:34
【问题描述】:
在 iOS 上,为什么即使我将 UserProfile 分配给我的 StoryboardId,我也会收到以下错误:
使用未声明的类型'UserProfile'
这是我的代码:
let mainStoryboard = UIStoryboard(name: "Main", bundle: Bundle.main)
guard let destinationVC = mainStoryboard.instantiateViewController(withIdentifier: "UserProfile") as? UserProfile else {
return
}
navigationController?.pushViewController(destinationVC, animated: true)
【问题讨论】:
-
你在哪里实现了 UserProfile 类?
-
在一个单独的文件中,但该类称为 userProfile
-
重命名为 UserProfile 或将类型转换为 as?用户资料
-
错误消失了,但 segue 不工作
-
您是否在情节提要中为您的 vc 添加了标识符?
标签: ios swift storyboard segue