English 中文(简体)
未能在Xcode中找到议定书声明
原标题:Cannot find protocol declaration in Xcode

I ve experienced something today while I m building my app. I ve declared a protocol in my MyObject1 and add delegate property on it. I ve assign MyObject2 as a Delegate of the MyObject1. I ve added it in this way as usual

@interface MyObject2: UIViewController <DelegateOfObject1>

But the Xcode says that my the protocol declaration cannot be found. I ve check my code but I ve declared this protocol. I ve try to assign MyObject2 as delegate of other Object. I ve edit my code like this

@interface MyObject2: UIViewController <UITableViewDelegate,DelegateOfObject1>

但Xcode再次指出,它无法找到代表OfObject1议定书的声明。 我曾试图删除我的代码上的代表OfObject1,并指定MyObject为其他物体的代表,我也这样做。

@interface MyObject2: UIViewController <UITableViewDelegate,UITabBarDelegate>

没有发现错误。 随后,我再次试图在法典中增加我的代表OfObject1。

@interface MyObject2: UIViewController <UITableViewDelegate,UITab BarDelegate,DelegateOfObject1>

当时,X密码没有发现我的代码有任何错误。 因此,我再次试图根据我的法典删除UITableViewDelegate和UITab BarDelegate。

@interface MyObject2: UIViewController <DelegateOfObject1>

当时没有发现任何错误,但这是前面写的同一法典。 我的法典可能会有什么样的原因?

......

最佳回答

我将我的礼宾声明单独存档,并将其输入MyObject2

问题回答

出现错误的原因是进口 lo。

错误必须是进口 lo。

I had import "AppDelegate.h" in both the classes.I removed it from the class which declared protocol and the error was gone. :)

#import "NameOfDelegate.h" 

页: 1

使用@em MyObject;以避免进口 lo。





相关问题
How to change out-of-focus text selection color in Xcode?

Okay, I ll bite. I ve got really pleasant code/window colors set up in Xcode. Ordinarily, my selection color is very visible. When I am doing a project search and iterating through the results, ...

Iphone NSTimer Issue

Hi I am new to objective c. I am trying to make an app for iphone. I have a button on my view, and the click on which the function playSound is called. This is working properly. It does plays the ...

Include a .txt file in a .h in C++?

I have a number of places where I need to re-use some template code. Many classes need these items In a .h could I do something like: #include <xxx.txt> and place all of this code in the ....

Iterating over string/strlen with umlauted characters

This is a follow-up to my previous question . I succeeded in implementing the algorithm for checking umlauted characters. The next problem comes from iterating over all characters in a string. I do ...

Xcode open two editor windows with same file

Is it possible to open the same file in two separate windows in Xcode. I can open a file in one window and the same file in the main Xcode editor window, but I wanted two separate fulltime editor ...

Forcing code signing refresh in Xcode

In our environment, we share resources across multiple projects and platforms. When building for iPhone, only a subset of those resources are needed. Since that subset is still considerable, we have ...

热门标签