开发者

Error : "Category" declared as different kind of symbol in XCode 4 [closed]

开发者 https://www.devze.com 2023-03-22 21:30 出处:网络
It's difficult to tell what is being asked here. Th开发者_如何学编程is question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current for
It's difficult to tell what is being asked here. Th开发者_如何学编程is question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

I have created my own classes Category.h and Category.m. Category class is inheriting NSObject. In my project there is only one class named Category.

At following line, it's showing me this error.

@interface Category : NSObject

Any help would be greatly appreciated. Thanks!


If you check the documentation there's Category type which is:

typedef struct objc_category *Category;

You are getting this error because Category is defined as a pointer to struct objc_category.

If you want to avoid these kind of errors I suggest you adding your own prefix to all the classes you make in the project. Either from your name:

  • Your nickname: iAsh
  • ClassPrefix: IA
  • Example class: IACategory

or from project name:

  • Project: Awesome Project;
  • Class prefix: AP
  • Example class: APCategory

Also double-checking with documentation is always good. It's very rare that you'll hit existing class, but possible.

0

精彩评论

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

关注公众号