I have an app with two localizations.
Usually I use 'NSLocalizedString' and keep the same source code for both localizations, but one of my ViewControllers has to look and function different for each locale.
So I pressed 'Localize..' and created two localized versions of it. Normal stuff.
Since then - on runtime I get:
Unknown class MyViewController in Interface Builder file.
and the viewcontroller is not displayed (it's a UITableViewController if it matters).
I checked in my storyboard and the custom class is still listed & linked to the view controller display. I didn't change the class name in each locale - it's still the same.
what gives here?
thanks
i experimented this kind of problem in my project and my problem was my viewcontrollers .m file was not included in the compile sources in Build Phases->Compile Sources i manually add it to the Compile Sources and problem solved for me.
i hope it will help you.
Related
Pretty basic stuff but i am unable to troubleshoot where the problem is. In my project, i have a class named "TheFeedStore" with following two methods:
- (BOOL)hasItemBeenRead:(RSSItem *)item
{
............
}
- (void)markItemAsRead:(RSSItem *)item
{
.........
}
I am using 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 another class, 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 manner, i get the error "No visible #interface for 'TheFeedStore' declares the selector 'hasItemBeenRead:"
1) I have imported TheFeedStore.h file in the classes from i am
accessing these methods of TheFeedStore class.
2) I have checked like 10 times and there is no typo.
3) The methods i am accessing are also declared in the header file of
TheFeedStore.h
UPDATE: Just to check, i have declared another test method in TheFeedStore.h, same result, one class can access the newly created method while rest of the three classes cannot.
UPDATE: I have tried creating more methods in the TheFeedStore.h just for troubleshooting this issue. The new methods are also not accessible from the other classes. But if the return type of these new methods is (RSSChannel*) which is another model class in my project, than they become accessible. If their return type is other than some class like (void) and (BOOL) then they are not accessible. Here is my TheFeedStore.h https://gist.github.com/jessicamoore112/5558473
You have said that you are using #class instead of #import in your header files, the methods that you are trying to access are declared in the header files and there are no typos of any kind.
In such cases, usually no body points this issue but i am going to do it anyway because i have faced such issues many times. You have probably created many copies of your project to work on each functionality and also keeping a working project.
When you do this, sometimes Xcode is still using the older copies of few files. That means it is still using the older copy of the TheFeedStore.h when the methods you are trying to access were not declared by you.
How to solve this problem is very simple. Go to the file from which you are trying to access the methods and the files in which these methods are declared.
In the Utilities section on the right hand side, check the location and full path under "Identity and Type" area.
First check the names of the project, if it is different from the project name that you are working on, that means Xcode is still pulling the old copies of the files from the previous revision of your project. See the blue arrows where the project name is 13SampleMoreRequests in my case.
If this name is same as your project name, then my answer does not solve your problem. If its different, you should use the new copies of the file by browsing the new location using the sign that is pointed out by red arrow.
Once you browse and use the new files, your problem will be solved and you will be able to access the methods. If you still can't, copy these files, delete from the project and then add them again and you won't face this problem.
Hope this helps!
Cyclical imports, e.g. A.h imports B.h while also B.h imports A.h is the most common problem.
In C, cyclical imports won't work and one of the imports will be silently ignored. Make sure you are not having a cyclical import. If you do, solve it (e.g. using forward declarations).
Import problems can be also easily inspected if you generate the preprocessed output (you can find it in one of the Xcode menus).
That might sound silly, but I have similar cases once in a while and sometimes just simple quitting and starting xcode helps, it tends to stuck sometimes.
Also, sometimes cleaning the project helps.
'Cause I have very similar to yours singleton code and it works fine.
Guys I had encountered the exact same issues. After some searching on 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 place all my methods in 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 button-click on my app that's where the problems started.
I got the error/warnings "ARC Semantic Issue: No visible #interface for Class declares the selector" every time I built or ran the app simulator.
My Solution was to go back to RadioStation.h file and just declare all my methods there.
Since they were already defined on RadioStation.m I was good to go.
So make sure you have properly declared your methods on the file that is going to be imported on your viewControllers.
Hope that helps.
In my case I had some very strange path entries in
Framework Search Paths
Library Search Path
(Targets -> YOUR_APP_NAME -> Build Settings in "Search Paths" section)
I removed them and the error messages are gone.
excuse me to create again this question, but I have another problem. I'm trying to integrate the aurioTouch Apple sample in my app. I have put all the code that was in aurioTouchAppDelegate in my app delegate file. The code runs, but some methods, like methods in EAGView file doesn't run, I don't know whym they are not called.
Some help or hints are welcome...
Have you integrate all the setting from Project's Build Settings. Actually I had the same issue but then I compare all the settings from Build Settings and found that some of the Linker flags were creating the problem and then was able to solve the problem. So whenever you have such problems try to go to Project's Build setting and compare all the keys. Mostly the Linker flags creates the problem in such cases.... hope this help to others also...
EDIT
After referring to your project. Notice that you have overloaded the property view of ViewController with your custom View EAGLView. You have not separated customView and ViewController's view.
Also, one major thing is you have to Initialize your EAGLView and add it to your ViewController's view. and rest of the things will go on in EAGLView.
Using core-plot does not seem to be an easy integration task. Header path are already setup. In Interface-Builder I create an CPLayerHostingView which belongs to a View Controller which is instantiated by Interface Builder.
When the nib file is loaded I get the message:
Unknown class CPLayerHostingView in Interface Builder file
I found, that there are two different versions of that object. One for Mac-Only called "CPLayerHostingView", one for iPhone only called "CPGraphHostingView".
If following the poplular example at http://www.switchonthecode.com/tutorials/using-core-plot-in-an-iphone-application you would use the following lines, if building an iPhone-App:
CPGraphHostingView *graphView = (CPGraphHostingView*)self.view;
graphView.hostedGraph = graph;
http://www.switchonthecode.com/tutorials/using-core-plot-in-an-iphone-application
Here is the answer ..
U can see mars' answer there
"i got it to work....ok, i added the -all_load -ObjC flag in the Target>Settings....I think this is where everyone gets confused...There are 2 places where to put the other link and header search paths, in Project Settings and in Target Settings.."
So solution is
Add -all_load -ObjC in Project settings and target settings
I had to rename CPLayerHostingView to CPGraphHostingView to get this to work after upgrading to the latest version of core plot (along with iOS 4 and the upgrade of XCode).
I think you're saying that you get this error when you load the NIB file in your app's code. In that case, the error suggests that you haven't built the Core Plot classes into your application (iPhone) or linked against the CorePlot framework and copied into the app bundle's Frameworks/ directory (OS X).
CPGraphHostingView
thank u it worked for me aswell;
3 imp things
1>perform settings for both project target aswell as application target.(make sure configuration is all configuration)
2>give correct header search path for framework library
3>learn over it::::::-)
For whatever it is worth.
Followed tutorial: http://www.switchonthecode.com/tutorials/using-core-plot-in-an-iphone-application and ended up having that same error. I looked into the CorePlot framework folder and did not find that CPLayerHostingView there, but found CPGraphHostingView inside iPhoneOnly folder.
Changed CPLayerHostingView to CPGraphHostingView in IB and error disappeared.
So, check what is in yours and use it. May work.
I have refactored some UIView sub-classes into a static library. However, when using Interface Builder to create view components for a project that uses the static library I find that it is unaware of the library classes. What do I need to do to make the class interfaces visible to Interface Builder?
Update: The correct answer refers to dragging the headers into the 'XIB browser'. The '.h' files can be dragged from a finder window to the window area identified in this image:
alt text http://img211.imageshack.us/img211/1221/xibbrowser.png
Try dragging the static library into your xib browser in Interface Builder. I haven't tried this with a static library, but the concept is the same. When you drag header files into IB, you can access those classes.
LexH, try linking with the -ObjC flag when building your static library. That worked for me... for about a year :-) I found this post as the problem has returned with a fresh OSX install and an upgrade in xcode. But it worked in XCode 3.1.2.
David
Add the same problem as LexH. It worked only when I called a dummy class method.
The problem was that I did not add my static library to the "link binary with libraries" under target.
Strangely everything else worked.
I followed this guide to link with my static lib Create static lib
I had the same problem. Dragging the library or headers to XIB Browser didn't work. Read Class Files didn't work. So I called:
[MyLibraryClass version]; // Substitute your class name for "MyLibraryClass".
This worked. version is a class method of NSObject, so all subclasses of NSObject inherit it.
I have a static library that includes some xibs. These will basically be the same across projects. I'd like to include the xibs as part of the library. I can include their veiwcontrollers, reference these controllers in the calling project but then there isn't a xib to load. When I right click the xib in the library project, it can't be part of the target.
I thought about creating a CFPluginBundle but that creates a new project. I'd loose all of my IBOutlet and IBAction references. What is the best way to reuse xibs that also have outlets and actions to specific controllers?
Here more discussion about it: Can you reference Xib files from static libraries on the iPhone?
I had the same problem when I wanted to export my project as a library for other developers to use.
I found the perfect solution to my view and it seems it will answer yours too.
There is an xcode plugin that allows you to build your project as a library which includes the resources as well.
https://github.com/kstenerud/iOS-Universal-Framework
I do not know the guys that built this plugin, but it works like a charm
I'm not sure what you mean by "include the xibs as part of the library", since static libraries can't have resources--but they also aren't shipped stand-alone, so they don't need to. If you just want code re-use for your own projects, you could keep the xibs where-ever you keep the static library, and just include the xibs in any project that uses the library.
If you go the CFPluginBundle route, you can make new bundle targets in an existing project; there's nothing magic about the templates, they just take care of making dummy files and turning on the right build settings. You can copy those into a new target in your existing project and it will work just fine. That said, I'm not sure what you mean about losing IBOutlet and IBAction references, since that information is part of the xib (and the class you are using in the xib), not the project.