简体   繁体   English

Xcode轻击手势导致错误

[英]Xcode tap gesture causing error

I created two views in Xcode using the hierarchical view layout. 我使用分层视图布局在Xcode中创建了两个视图。 I initially created a button on the first page (PlaylistMasterViewController) which activates the segue method to transition to the next page in the hierarchy (PlaylistDetailViewController), which worked just fine. 我最初在首页(PlaylistMasterViewController)上创建了一个按钮,该按钮可以激活segue方法以过渡到层次结构的下一页(PlaylistDetailViewController),效果很好。 I then deleted the button, and added a tap gesture to one of the UIImage view elements in the masterViewController and deleted the button. 然后,我删除了按钮,并向masterViewController中的UIImage视图元素之一添加了轻击手势,并删除了按钮。 I created the action outlet of the touch gesture to activate the segue and made sure to delete all of the uses of the button in my code, yet this error is thrown once right after the splash screen loads (run time). 我创建了触摸手势的动作出口来激活segue,并确保删除代码中所有按钮的用法,但是在启动屏幕加载(运行时)后立即抛出此错误。 Any ideas what might be causing this? 任何想法可能是什么原因造成的?

Xcode错误控制台输出

In your storyboard check your PlaylistMasterViewController for a connected outlet named showPlaylistDetail with a little while exclamation mark next to it. 在情节showPlaylistDetail ,在PlaylistMasterViewController检查showPlaylistDetail有一个名为showPlaylistDetail的已连接插座, showPlaylistDetail带有一点惊叹号。 Then hit the 'x' and clear that outlet connection. 然后点击“ x”并清除该插座连接。

It's most likely some outlet you previously connected and later removed from your code. 这很可能是您先前连接的某些插座,后来又从代码中删除了。

The image below is just an example to show you what it would look like. 下图只是一个示例,向您展示它的外观。

在此处输入图片说明

最常见-从ViewController到情节提要中已删除的按钮都有出口

You might have deleted the button but something in the view itself may still be referencing it. 您可能删除了该按钮,但是视图本身中的某些内容可能仍在引用它。 As the view is loaded at runtime when you try to bring up the view it may have UIButton connected to an outlet that no longer exists. 当您在尝试运行视图时在运行时加载视图时,它可能会将UIButton连接到不再存在的插座。

Open the view in Interface Builder and make all the ui elements in that view are properly wired up and not referencing a non-existent IBOutlet. 在Interface Builder中打开视图,并确保该视图中的所有ui元素均已正确连接,并且未引用不存在的IBOutlet。 If there is a problem you'll see a yellow warning icon to indicate a problem. 如果有问题,您会看到一个黄色警告图标,以指示问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM