XCode 4 stopped highlight and recognizing UIKit classes on project - xcode

Hi i get problem with xCode 4.
I develope project with XCode4 on home and on work.
And i store it on my USB flash drive.
Today i get some problem.
I open xib file for add outlet to code and get next error "Could not insert new outlet connection: Could not find any information for the class named ..."
Class exist and property of xib file setted correctly.
Could not insert new outlet connection: Could not find any information for the class named
Ok, think i, i write code and the connect using Files owner.
Next step i open code editor of .h class file and try to write UI... and see nothing. i dont get list of classes UI types
Next i saw what XCode code editor does not highlighting classes of UIKit and else frameworks too.
But i dont have this error on another projects and on it project but on home computer.
Some body have same problem?

Try this: Close your project. Choose Window > Organizer from the main menu. Select the Projects panel. Select and delete all copies of your project from the list. Open the project again (Xcode will rebuild the necessary information).
This will not delete your project, but the index and other information Xcode discovers about your project. As I said, Xcode will rebuild the information as soon as you re-open the project.

We had a really similar problem happen to us and none of the help out there worked. What did end up fixing it was deleting the .m and .h file from xcode (resource only) and then dragging them back into the project from the project folder. It seemed to relink everything and make it work again.

Just add .m files in Compile Sources under:
<My Project>
-- TARGETS <My App Name>
-- Build Phase tab
-- Compile Sources
It fix the problem.

I noticed that .m file was moved inside en.lproj folder.
Just delete (reference only) the .m file from the Xcode and moved .m out of the en.lproj.
Add it again.Don't worry, you will get all your connections back.
It will fix the issue.

Related

Xcode suddenly corrupted my xib file

Last thing I did with it was adding a checkbox and creating an outlet using assistant view. Since then Xcode doesn't compile my project, gives me this error and I don't know what to do with it...
Do a complete clean and rebuild of the project.
Also, does your console log indicate any potential problems?
If that does not work and you have a backup, copy your backup to a new location and see whether you have the same problem.
If none of the above worked, then you just have to copy the xib and associated .m and .h somewhere, delete them from the project. Then re-add them. You can copy and paste the .m and .h but you need to remake the xib from the start then link all the outlets and actions.

XCode: Project Files no longer linked with project/storyboard

Recently, some revision was done to one of my projects and the project had to be re-imported from SVN. All of the files are there, but I get weird issues when trying to use some of the project files.
For example, when selecting a view in IB, the assistant view would automatically show the associated header file for that view. Now, there is nothing under the 'Automatic' tab in the assistant view.
Also, when trying to #import certain files and create instances of them, xcode returns the error Unknown type name
I seemed to have resolve the issue. I had to create a new .h and .m file and copy the contents of the old .h and .m into the new one. Once I set the view in storyboard to use this file I no longer received any errors.

XCode Unknown class ***** in Interface Builder file

In an app, suddenly it's giving me the error XCode Unknown class ***** in Interface Builder file. I reviewed everything, storyboard, classes, etc.
I try to rename the class but it is the same problem, even I created a new class and copy the code in. I think XCode is taken that from a kind of cache because even properties that I deleted like the icon in the tab bar item are still present in the app when I run it.
What can be the problem?
Also if using a static library, don't forget to add the -ObjC flag to Other Linker Flags in your projects Build Settings tab.
If you have failed to do so, "Unknown class ... in Interface Builder file" will occur when trying to load a view controller from the static library in IB.
Just another case I experienced the error will show.
I faced a problem when I created a project with the same name that already existed in my projects directory (though it was deleted some time ago). Xcode didn't understood that it's a new project and use build directory of old project as a build directory for a new one. I didn't knew how to completely rebuild project from scratch and I just removed a build directory.
In my case I removed /Users/username/Library/Developer/Xcode/DerivedData/ProjectName-suffix. You can find it in Xcode in Project navigator on the left by selecting ProjectName->Products->ProjectName.app and File inspector on the right will show you a full path to file.
Sorry, after trying several post I found one solution, delete the folder of the simulator in /...Library/Application\ Support/iPhone\ Simulator/ and removing the class and re-adding it.
You will need to add to your targets Other Linker Flags as well, just adding to the Project Build Settings does not seem to work.

XCode has lost associating from xib to .h file (MonoTouch)

When I am editing an XIB in XCode I don't get the associated .h file to show up in the assistant editor window. Other XIB's work fine.
This is a problem as it's the way I create outlets by dragging onto the assistant window. If I open the .h file manually in another window I can't associate an outlet this way either. The .h file exists.
Also, my project is MonoTouch and therefore I invoke the opening of the file from MonoTouch. I assume it's a problem originating in MonoTouch and not Xcode.
Someone please help, or I will be forced to learn Objective C soon and quit with this MonoTouch business.
Sometimes there is a different solution, such as when the controller file is RENAMED.
When this happens, edit the .XIB file with the Source Control Editor (right click on .xib, Open With->Source Control Editor), and make sure that all references to the name of the controller are correct and that the path and name of the .h file are correct.
Look in the "IBClassDescriber" element specifically. The "className" under the "IBPartialClassDescription" element and the "minorKey" under the "IBClassDescriptionSource" element must be correct. MT will generate a .h file with the same name as the controller.
After making the changes, save the file, choose Build->Clean All, then double-click the .XIB file to open it in XCode.
It may or may not work for you, but it worked for me when everything else failed.
As Stuart mentioned in his comment, deleting the /obj folder under the project which contains the .xib files, force MT to regenerate .h files
Came across the same issue and removing the /obj directory and restarting did the trick.
MonoDevelop 3.0.3.5 with XCode 4.4.
Was rather confusing as I am came across issue whilst on first MonoDevelop iOS Helloworld tutorial.
In my case, this issue has appeared when I change a namespace in .cs view controller file according to the file location. But after that, I caught this issue. When I have returned namespace to incorrect variant I got back my .h file.
Update:
You need to change the namespace in view.cs and in view.designer.cs, then Xcode .h file will be generated correctly.

Header file for view controller not created with MonoTouch

This question is the same as this Missing h-files and Assistant Editor not working because of it (monoTouch/MonoDevelop) but none of the answers work for me. When I double-click the XIB file from monodevelop no header file is created in XCode 4.2, even after I edit the XIB in Xcode and re-save, or when I quit Xcode and monodevelop and re-open. I have expanded every folder in Xcode and there is no ViewController.h file anywhere.
I've had this happen quite a few times :( The solution is to manually create the partial class in MonoDevelop, inherit from the UI class you need, and finally add the Register attribute.
[Register("MyCustomView")]
public partial class MyCustomView : UIViewController {
....
}
Once you do that, and save your code in MonoDevelop it should automatically rebuild the xcode project file for you.
I had this same issue, and as of 5 minutes ago it seems to have resolved itself. I don't know what the direct reasoning for this was, but it started after I closed xcode, monodevelop and restarted my mac. It didn't work the first time I rebooted, but I noticed that there was another xcode project open when I double-clicked on the xib in monodevelop. So I closed the project and xcode again. Next time I double-clicked on the xib it was there!
So, my guess is it is some kind of fluke or system caching issue. If you haven't been able to resolve it yet maybe try doing a reboot so the system cache can be cleared and make sure you don't have another project open in xcode when you try to open the xib from monodevelop?
I have noticed that deleting the "obj" folder of your project often helps. In there MD is storing all the helper fiels required by Xcode. This folder is not properly cleaned if you "clean" your solution from the build menu.
Quit Xcode, delete the folder, double click your XIB and the folder will be recreated.

Resources