- iOS Xcode, 解决“Could not insert
- iOS Xcode, 解决“Could not insert n
- iOS Xcode 解决 "could not insert n
- iOS Xcode, 解决“Could not insert n
- iOS Xcode, 解决“Could not insert n
- IOS中提示could not insert new actio
- 解决Xcode 的"Could not insert
- 解决Xcode 的"Could not insert new o
- "could not find developer
- IOS,SWIT 解决“Could not insert new
在Xcode中,我们可以在StoryBoard编辑界面或者是xib编辑界面中通过“Control键+拖拽“的方式将某个界面元素和对应的代码文件连接起来,在代码文件中创建outlet。
不过,如果你的运气不太好,执行以上操作的过程中你可能会遇到下面这样的错误:
Could not insert new outlet connection: Could not find any information for the class named "xxx".
其中的“xxx”就是你的目标代码文件中的类名。如果自己没有错误,这完全是Xcode的原因。
下面,介绍一种简单方便的方法:
1: 删除并重新添加.h和.m文件
选中出问题的.m和.h文件,点删除键,然后选“Remove Reference”,不要真正删除文件。接着选“File -> Add Files to ...”菜单,在文件选择界面选择刚才的.m文件和.h文件将他们重新加入项目中。
马上试一下是不是已解决!
2: 最近有朋友反映不能够解决,可以这样
在Xcode中选择“Windows->Organizer”,然后选择“Projects”,选中你正在处理的项目,点击“DeriveData”对应的“Delete”按钮,Xcode会删除该项目的DeriveData,然后自动重新生成一个。重新启动Xcode。还不行请重启电脑,亲测可行。
网友评论
1,Clean the project (Product > Clean)
2,Manually paste in
@IBOutlet weak var viewName: UIView!
// or
@IBAction func viewTapped(_ sender: Any) { }
and control drag to it. (Change type as needed.) (Idea from this answer. Please upvote it.)
3,Completely close Xcode and restart your project.
4,Delete the Derived Data folder (Go to Xcode > Preferences > Locations and click the gray arrow by the Derived Data folder. Then delete your project folder.)
5,Click delete on the class, remove reference (not Move to Trash), and add it back again.