ARC Semantic Issue: No visible @interface for class declares selector

Pretty basic things, but I can’t fix the problem, where is the problem. In my project, I have a class called "TheFeedStore" with the following two ways:

- (BOOL)hasItemBeenRead:(RSSItem *)item { ............ } - (void)markItemAsRead:(RSSItem *)item { ......... } 

I use the following class method, so other classes can access these methods using it:

 + (TheFeedStore *) sharedStore { static TheFeedStore *feedStore = nil; if (!feedStore) { feedStore = [[TheFeedStore alloc] init]; } return feedStore; } 

In one of my other classes, I can easily access the above methods by writing

 if ([[TheFeedStore sharedStore] hasItemBeenRead:item]) 

or

 [[TheFeedStore sharedStore] markItemAsRead:entry]; 

But in another class, if I try to access these methods in a similar way, I get the error message "No visible @interface for" TheFeedStore "declares the selector" hasItemBeenRead: "

1) I imported the TheFeedStore.h file into classes from I access these methods of TheFeedStore class.

2) I checked like 10 times and there are no typos.

3) The methods I refer to are also declared in the TheFeedStore.h header file

UPDATE: Just to check, I declared another test method in TheFeedStore.h, the same result, one class can access the newly created method, while the other three classes cannot.

UPDATE: I tried to create more methods in TheFeedStore.h just to fix this problem. New methods are also not available from other classes. But if the return type of these new methods (RSSChannel *), which is another model class in my project, becomes available. If their return type is different from some class (void) and (BOOL), then they are not available. Here is my TheFeedStore.h https://gist.github.com/jessicamoore112/5558473

+4
source share
5 answers

You said you use @class instead of #import in your header files, the methods you are trying to get are declared in the header files, and there are no typos.

In such cases, as a rule, no authority points to this problem, but I will do it anyway, because I have encountered such problems many times. You have probably created many copies of your project to work on each functionality, as well as to maintain a working project.

When you do this, sometimes Xcode still uses old copies of several files. This means that it is still using an old copy of TheFeedStore.h when the methods you are trying to get were not declared by you.

How to solve this problem is very simple. Browse to the file from which you are trying to access the methods and files in which these methods are declared.

In the "Utilities" section on the right, check the location and full path in the "Identification and Type" area.

First check the names of the project if it is different from the name of the project you are working on, which means that Xcode is still pulling old copies of files from a previous version of your project. See Blue Arrows, where the project name is 13SampleMoreRequests in my case.

utilities

If this name matches the name of your project, my answer does not solve your problem. If it differs from another, you must use new copies of the file, looking at the new location using the sign indicated by the red arrow.

As soon as you browse and use new files, your problem will be solved and you will be able to access these methods. If you still cannot, copy these files, delete them from the project, and then add them again and you will not run into this problem.

Hope this helps!

+5
source

Loop imports, for example. Ah imports Bh , and Bh import Ah is the most common problem.

In C, looping imports will not work, and one of the imports will be ignored. Make sure you do not have circular import. If you do, allow it (for example, using forward declarations).

Import problems can also be easily checked if you generate pre-processed output (you can find it in one of the Xcode menus).

+2
source

It may seem silly, but from time to time I have similar cases, and sometimes just shutting down and starting xcode helps, it sometimes gets stuck. In addition, cleaning up a project sometimes helps. Because I am very similar to your single code and it works great.

+1
source
Guys, I ran into the same problems. After some searching in SO and the search engine, I was able to solve it.

In my case, I have four files:

  • RadioStation.h
  • RadioStation.m
  • ViewController.h
  • ViewController.m

My mistake was to put all my methods on RadioStation.m and only put my variables on radioStation.h so when I import radioSation.h on my ViewController.m and try to define methods for clicking a button on my application, what’s there where problems have arisen. I got an error / warning "ARC Semantic Issue: No visible @interface for class declares selector" every time I create or run an application simulator.

My solution was to go back to the RadioStation.h file and just declare all my methods there. Since they have already been identified on RadioStation.m I was good to go.

So make sure you correctly declare your methods in a file that will be imported to your viewControllers. Hope this helps.

+1
source

In my case, I had some very strange path entries in

  • Wireframe Search Paths
  • Library Search Path

(Goals → YOUR_APP_NAME → Build Settings in the Search Paths section)

I deleted them and the error messages disappeared.

0
source

Source: https://habr.com/ru/post/1479662/


All Articles