Xcode 5 can't open .m file - xcode

I installed Xcode 5 a few hours ago. I opened my project with it. I have several .h and .m file in my project. I could view all of them except one of my .m file. When i clicked that .m file, the cursor became rainbow and nothing happened.
To be sure , i checked my project folder, go to the that .m file and click get info. I could see the preview of that file. Also i could open it in text editors.
I couldn't find the problem. Any advice is appreciated.
Best Regards,
Taha
I created a new project to check that .m file. And the result is positive. But still i can't open that .m file in my real project.

Weird solution but works for me.
1) Delete .h and .m files.
2) Right click on xx.xcodeproj and click show package contents.
3) Delete project.xcworkspace.
4) Add .h and .m files again.

Related

Is it possible to force xcode to save your code?

I'm trying to make a plugin that writes something to the .h file with a key command while you're coding in the .m file.
But if I've just made a change in the .h file and go to my .m file and use my plugin directly after, I get an error popup saying that Xcode has changes that is not on the disk yet, and then asks which version I want to use.
If I'm only coding in the .m file and adding the methods and properties to the .h file with my plugin it works fine, it's only when I've just made some changes myself to the .h file and go back to the .m file and use my plugin that I get an error.
So my question is, is it possible to force Xcode to save your code, so you're sure it matches up before you make any changes to what is already on the hard disk?

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 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.

XCode 4 stopped highlight and recognizing UIKit classes on project

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.

Resources