首页 > ios > 意外删除了app delegate.h和.m并且无法恢复它们

意外删除了app delegate.h和.m并且无法恢复它们 (accidentally deleted app delegate.h and .m and cannot restore them)

2012-09-15 iosxcode

问题

我不小心从应用程序的文件夹中删除了应用程序delegate.m.h文件。

然后在xcode中我可以看到名称(Appdelegate.h and .m)但没有内容。

我在垃圾箱中找到了这些文件,然后将它们拖放到xcode中,现在我看到两个文件的双打。

如果我尝试运行我的项目,我会不断收到此错误:

duplicate symbol _OBJC_IVAR_$_AppDelegate._window in:

如果我删除两个重复项中的一个,则两个都将被删除。

解决方法

确保delegate.m仅在Compile-Sources中列出一次。

要做到这一点; 点击项目导航器左上方的项目,点击目标,选择Build Phases,展开,Compile Source然后检查是否delegate.m只在那里一次。

问题

I accidentally removed app delegate.m and .h file from the folder of the app.

Then in xcode I could see the name (Appdelegate.h and .m) but with no content.

I found the files in the trash and I dragged and dropped them in the xcode and now I see doubles of both files.

If i try to run my project I keep getting this error:

duplicate symbol _OBJC_IVAR_$_AppDelegate._window in:

If I remove the one of the two duplicates, both are being deleted.

解决方法

Make sure delegate.m is only listed once within the Compile-Sources.

To get that done; tap on your project on the left top within the project navigator, tap on the target, select Build Phases, expand Compile Source and now check if delegate.m is in there only once.

相似信息