开发者

iphone 'No declaration of property 'doSomethingButton' found in the interface' error

开发者 https://www.devze.com 2023-01-04 13:10 出处:网络
I am really confused - I am implementing a change to a button in several views and it works in all but 1 of them and I can\'t figure out what is different.

I am really confused - I am implementing a change to a button in several views and it works in all but 1 of them and I can't figure out what is different.

I have it declared in the .h file :

    UIButton *doSomethingButton;
}

@property (nonatomic, retain) IBOutlet UIButton *doSomethingButton;

But then in the .m file I get the error 'No declaration of property 'doSomethingButto开发者_StackOverflown' found in the interface' in the @synthesize line and then again on the lines where it is actually used. I made sure the .m file imports the .h file. I made sure that the outlet is used correctly in Interface Builder. What else could be causing the problem?


For future reference:

I just had this happen to me. It turned out, the header (.h) file was not actually included in the project.

The tricky part is, Xcode still let me jump between counterparts and edit the file as normal, but when I tried to reveal the file in the group tree, it wasn't there.

Dragging the file back into the project from the Finder fixed the problem.


Are you sure you are doing the following in your .m file (ensure this is inside the implementation block):

@sythensize doSomethingButton


Odd; check very carefully for misspellings. I've also been occasionally burned by invisible characters ending up in the source.

Do other @property declarations work in the same pair of files?

0

精彩评论

暂无评论...
验证码 换一张
取 消