Related
I just saw a weird error on one of my iOS projects.
I'm using Xcode 8 (last release). I have some classes that I share along with other projects. This files are added to the project by reference, in case I need to edit them, I do it just once.
Everything works fine. But I saw that many of this files are on red in one of my projects. The weird thing is that everything works well. All libraries are included, everything runs perfectly. Like I said, the files are marked as red and I can not edit them directly from that project but they are not missing (paths are OK), I cannot go directly to the folder using "show on finder" option.
I tried replacing the folders. Also tried to added and copy them to the project folder. But nothing seems to be working.
I know, there are many threads about this issue but none of them worked for me because my files are not missing.
Did someone see this issue?
PS. I'm using git.
Select the file in the Project navigator on the left, then open the right side Utilities view and select the File inspector. Then click on the little folder icon and make sure that points to the right path.
I have the same problem - definitely not missing files. This is too late for OP but for anyone finding this ... it might help to change the file 'Location' setting from "Relative to Group" to Relative to Project" and then clicking on the folder to reselect the file. It worked for me. I think the path of the group can get messed up.
I would suspect that the files are missing, but Xcode is able to still compile because it's picking up older version from the derived data directories.
I would suggest clearing your derived data to be sure.
the files are marked as red and I can not edit them directly from that project but they are not missing (paths are OK), I cannot go directly to the folder using "show on finder" option
Then the paths are not OK. You need to find these files and add them to the project again. Then delete the red file references.
I am having an issue where the code associated with some of my View Controllers is not showing up in the Assistant Editor window to the right of the Storyboard. It says "No Assistant Results" where the swift code should be.
Things I have tried (There are many things):
Cleaning project
Deleting DerivedData
Creating new, identical View Controllers to see if the issue was just in those particular views.(the same issue occurred)
Deleting and Reinstalling Xcode
Restarting my Computer.
NOTE: I also am getting a warning at the top of the editor: Internal Error has occurred, source Editor functionality is limited.
Ok, I've had this problem before. I couldn't remember how I solved this so I searched on Google and found this question. But this time, nothing helped me. These are the things I did. I believe the last one solved this.
Clear Derived Data. Go to Terminal and enter this: rm -rf ~/Library/Developer/Xcode/DerivedData
Quit the whole Xcode.
Close all tabs of Xcode and make sure to view some class files instead of Interface builder and go try again viewing assistant results.
Remove the assigned class to the View Controller nib you think causes the problem, then assign the class again. Boom! Solved!
This method worked for me: (Xcode 10.2)
1- Select the broken ViewController on the StoryBoard
2- In Identity Inspector, change the item in Class to another class (any class)
3- Change the Class back to related class
4- Save and close the project
5- Reopen the project
What worked for me was to close Xcode entirely, open again, and then I tried assistant.
Just do a simple close the app and open the app again. It worked for me
Deleting derived data did not work for my problem.
This is how I solved this when I encountered this issue,
Go to the file that contains your class, go to File inspector > Target Membership, and then make sure that there is a check mark in the target of your project.
I hope this solves your issue.
Go to Assistant Mode on the upper right.
Click Command + Shift + T. New window will be opened and close the old one. You will be able to see something. Now go to Top Level Objects and select your file.
Click option+alt and click on the view controller you want to present.
Argh! This annoyance happens to me all the time.
I'm not 100% sure I know what the fix is, however I think I may have just "fixed" this a few seconds ago using the following voodoo:
1) Delete derived Data
2) Close xcode, reopen Xcode. Maybe Wait for indexing to finish?
3) View a source code file (.m,.h, .swift) in the main editor, the assistant editor should now show "Counterparts".
4) Change this to "Manual" rather than "Automatic"
5) Switch back to your nib/storyboard
6) Change back to "Automatic" rather than "Manual"
7) Probably continue pulling hair out :)
Edit
Seems as though maybe only step 3 is required as this happened again just now.
I had this issue and was able to resolve it. I resolved it by viewing the storyboard as source. I then removed everything in and including the tags (Saving it to restore later). I then went back and viewed the storyboard normally and created a new ViewController. Once the new ViewController was on the storyboard the assistant editor acted as normal. I then went back and viewed the storyboard as source code once again and replaced the current tags with the one I removed previously. This resolved my issues hopefully it will help for you.
For me (Xcode 11) it was cause by installing cocoapods, tried all the trick that I could find. Finally this helped me. Go to Xcode File Menu -> WorkSpace Settings -> enable legacy build systems
The same problem happened to me.
I only have to restart Xcode (12.2)
For any one who is encountering the same problem in Xcode version 13.3
Explanation: for me, the reason why it wasn't working is that I created a controller, view, and model Folder and I put the Main.storyboard inside the view folder and the viewController.swift inside the controller view, therefore when I try to access the assistant Result Xcode doesn't know where the viewController file is, so he is not able to connect between the storyboard file and the latter.
Solution: What worked for me is that I simply ran the app and it automatically connected the viewController with the storyboard.
I hope this was helpful.
I don't know if this is still helpful or not, for what is worth, the way I managed to restore this when it's been working perfectly and all of a sudden it stopped is by changing Assistant Editor view-mode.
I usually have it in Assistant Editors at bottom, so just change it to whatever else, such as All Editors Stacked Vertically and go back, and it should be working ok now.
xcode 8.3.2, if it's any use.
I tried various ideas mentioned here but nothing worked for me. So in the Project navigator, I right clicked on the .DS_Store file, clicked on Delete, and then chose "Move to Trash" on the confirmation prompt. After closing Xcode and opening it again, a new .DS_Store file was created. The Assistant Editor is working again and the .h and .m files appear in the Project navigator again. I am using Visual Studio for Mac which communicates with Xcode. Today I had to close and open both Visual Studio and Xcode after deleting the .DS_Store file.
you may have changed the name of the .swift file after you connected your IB oulets and IB actions.
select main.storyboard and select your view controller.
at the far right select identity inspector.
check if the class name is the same name as your .swift file, if it is not you need to put in the file name and the assistant should show up now.
In my case, the class name of File's Owner is incorrect (the class doesn't exist). I corrected the class name and it works again
Go to the view controller Identity Inspector (see the image). Change your controller to something incorrect, then change it back.
I had the same problem and I realized that selecting the Outlets option in the top of the Assistant Editor View solves the problem.
In addition to this, I found that if your classes are in several groups for some reason Xcode losses the reference to the class.
I setup the folder for the derived data when I installed Xcode in a folder I deleted cleaning my disk! So I created a new folder and I assigned in locations as above. Thats it! I was cleaning a file that didn't exist.
If the problem started after renaming the ViewController, first check whether you've changed the class name inside the ViewController file as well.
I have disabled xcode indexing, so after enabling indexing it starts working
Faced same issue.
For me it happen when I moved my view controllers to the new group.
The solution was unfortunate, but at least it worked again - I just moved the files back to the origin folder.
In Xcode 12.x, this will happen if you rename your ViewController file after creating it. If this is the case, just simply delete that ViewController file, and create a new one with a file name that you will not change, and then the Assistant window should automatically populate.
Please make sure that there is
no error in your project and your project is complining succesfully.
In my case, there was an error om some other class due to which I was not able to see assistant results.
After 7 imaginary hours, I finally found the answer. this is only for the storyboard for other people out there reading this is the answer if it does not help I don't care but here it is.
(This is an example project I cloned from GitHub)
Just select veiwcontroller.swift in the document outline, it should work.
Here is a screenshot.
Like i told, example project.
Had the same problem on Xcode Version 13.0 (13A233). As Glenn Posadas mentioned, deleting the derived data rm -rf ~/Library/Developer/Xcode/DerivedData then closing and re-opening the project solved the problem for me.
I had the same problem, so I re-organized files in folders and it got fixed. If you have the file in a specific folder, please put it outside that folder.
Try this (XCode 13.2.1):
In Storyboard, select the object whose class definition you want to
bring up in the assistant editor.
Delete the custom class in the Identity Inspector, being sure to
press the return key to lock in the change.
Quit XCode and reopen.
Re-enter your custom class name in the Identity Inspector.
I tried all the suggestions above and this was the only thing that worked for me.
Xcode 13.3.1
None of these worked but I did a clean and shut everything down and reopened and it worked.
One reason for this happening is moving the swift file to a different folder. If I move the swift file out of the folder, the assistant view works again. If I move the swift file back into a folder, it fails again.
After trying several tricks mentioned here, this seems to have finally worked for me:
Close the project,
Rename the project folder in Finder (i.e. the folder containing the .xcodeproj file)
Double click the .xcodeproj file to open the project.
It seems that paths stored in local cache files can be stubborn about being updated.
I keep trying to run my Xcode project (titled "YidKit") and it keeps giving me the following error:
error: /Users/Dani/Library/Developer/Xcode/DerivedData/YidKit-exnbjyxkgkbeaedoznkmtoenfijq/Build/Products/Debug-iphoneos/YidKitTests.xctest: No such file or directory. I spent several hours online, trying different solutions that I've seen, and nothing has worked. This is driving me crazy, because it is the only error left and I just finished getting rid of about 80 that were caused by Swift 2.0. I appreciate all of the help I can get!
UPDATE
Here is an image of the file in the explorer. The red one is the file that is giving me the error.
do following two things I might solve your problem.
Product -> Clean and build folder
Go to finder -> library -> Developer -> Xcode -> Derived data
delete that folder
or check screen shot may be this is your problem
and then check
TARGETS --> Build Phases --> search file --> delete redundant .m
For future reference
One way you can solve this problem is to open your Project with a text editor and search for the file there. It should be there the file path for it. Just delete it and any references that might exist of the file.
It should be working now.
Don't forget to BACKUP FIRST before doing this
Go to project, target, build phase
remove the files causing problem (click - below)
add the files again (File -> Add Files to Project)
clean then run
I'm sure you've figured out a workaround by now but for those still running into this problem the error is occurring because Xcode is trying to access a file for your project, but it can no longer find it. In your case the file it can't find is YidKitTests.xctest, so what you can do is click on it in the Project Navigator, then on the right in the File Inspector, click on the little folder icon under Location. When you click on the folder a Finder window will open up and its your job to navigate to where the YidKitTests.xctest file should be and double click on it. More often than not the file is in the exact place Xcode says it isn't, eg. /Users/Dani/Library/Developer/Xcode/DerivedData/YidKit-exnbjyxkgkbeaedoznkmtoenfijq/Build/Products/Debug-iphoneos/YidKitTests.xctest, but for some reason it can't see it without you pointing it out. I hope this helps!
I had a similar error popping up, and it turned out being the simulator was not being found. So, I deleted all my simulators and and added new ones. This fixed it for me. It's pretty unlikely this will be a fix for you, but I really wish I had seen this response 3 hours ago.
The solution which worked with me is as following:
Go in the left panel of the Xcode to products folder then select the Tests.xctest file
In the right panel of Xcode / Target Membership, unselect Tests
Click command u
Just delete the "Derived Data" folder and compile the project again.
Anyone tried the good old trick rebooting the computer? I tried and everything worked out fine! Give it a try
You should try to edit option in folder to show more you looking then you will see some error file inside after you find it delete it! Hope this help.
I want to duplicate my Xcode project since I need to do a lot of copies with slightly changes, but every time I try o copy it, It lose a lot of Constraints in Storyboard (even some controls disappear), I tried this
Duplicate and rename Xcode project & associated folders
but is in Xcode 4 and is not working for me
EDIT: In my Identity it said that the location is absolute and I can't change it (it is in gray)
Ok first of all its always going to transfer.
So please check to see if the references have been removed and if they have just drag and drop them into the file area.
if it does not work you should copy the files from original project, and use them to create a new file to make up for the missing files.
Hope this helps have a good day! :)
I am having a rather strange issue in Xcode on one of my projects.
When I start to write my code, I am used to the auto-completion suggesting numerous entries for me. For some reason, since yesterday, this has stopped working. I now get strange auto-completion entries such as "and", "the", "Andy", "MyCompanyName" etc.
This never happened before and so I am confused as to why it has occurred now, and only on one of my projects. I searched this site for quite some time for any fixes and I've attempted to clean Derived Data, quit Xcode, delete the workspace and user files from the Xcode project and restart, but after doing so, the auto-complete works for a while, then breaks again after about 30 seconds of coding.
I can sometimes see auto-complete solutions, but just plain text (no class indicators), then other times it stops working entirely.
Has anybody else experienced anything like this and could provide some solution?
I suffered for a long time with a project that kept losing auto-completion and syntax highlighting. Deleteing the Derived Data folder and restarting Xcode would fix it temporarily, and eventually that almost became muscle memory. My problem seemed to be exacerbated by using a workspace that contained multiple projects, many of which were dependant on each other. It turns out the problem was with the clang indexer. The project would compile cleanly, but looking at the output from the indexer it was littered with errors. Fixing ALL these resolved my problems.
BEFORE DOING ANYTHING: make sure ALL the targets in ALL the projects in your Workspace compile cleanly. That's without ANY warnings. This was a big failure on my part - I had old targets that just didn't compile cleanly. Some of these were unused and could be deleted, others were non-ARC that used modules in targets that had been converted to ARC (converted those targets too), and some just needed the code fixing.
Once you've resolved ALL those problems, the first thing we need to know is where the indexer is failing, by doing a complete index of your project.
First, Make sure Xcode is closed, then turn up the indexer warning
message level by entering in the Terminal:
defaults write com.apple.dt.Xcode IDEIndexingClangInvocationLogLevel 3
Then find the Derived Data folder for your project/workspace (probably ~/Library/Developer/Xcode/DerivedData/your project name-some gibberish), and delete it (but keep the Derived Data folder open because you'll probably have to go back and do this a few times.
Next, open the Console app and click Clear Display, and set the filter to "IDE" to only show the messages we're interested in.
Finally, open Xcode and the project/workspace that's causing your problems, and you'll see the console start to fill up with messages.
To look for errors, change the Console filter to "error:" - our aim is to reduce these to zero.
The majority of errors I found were missing header files. Xcode itself seems to be smarter than the indexer. It seems to be able to find and include header files from other projects that the indexer can't.
So, anywhere you see "fatal error: 'somefile.h' file not found", make sure you add the path of that file to the User Header Search Paths in the target's build settings. The best way I've found to do this is to double click on the field to get the popup, and drag the folder from the finder into it. This adds a new entry, but assuming it's in the same workspace, it adds a relative file path (this is important in case you move your workspace folder in the future). If you've got multiple targets for the same project, you can set the search path at the project rather than target level, and set the target search paths to $(inherited).
You might have similar problems with Libraries or Frameworks - again, update the appropriate search path.
Once your fixed some errors, close Xcode, clear the console, delete the project's Derived Data, open Xcode and let it index again.
Repeat until all your errors are gone.
Once you're in this good place, code autocomplete and syntax highlighting should work like a charm :)
Still happens to me occasionally on Xcode 4.3.2,
I simply do this:
Xcode > Organiser > Projects > Select your project > Derived Data > Click the delete button
This also deletes the indexing. I then usually restart Xcode and it starts re-indexing, and I get my syntax highlighting and autocompletion back again. (I don't even always restart Xcode - but an excuse to have a break from starting at a screen for hours is always a good thing for your glazballs!)
It happens that rarely, that this is relatively painless.
Most of the time I run into this problem deleting the DerivedData fixes it for me, but it one case it didn't. Turns I failed to connect the source file I created to any particular target. Once I connected it to a target source highlighting started working. If other solutions don't work, this might be your issue.
Search for 'GCC_INCREASE_PRECOMPILED_HEADER_SHARING' in build settings
and change it to YES. - This worked for me.
Its really embarrassing. By mistake I took off the Check mark in the Xcode Preferences> Text Editing> Code Completion and I tried every possible solution of that.
Please check this preference also before digging into any other solution:
You may be able to fix this problem by:
Commenting out all entries in the project's .pch file (normally when you do it, Xcode will pick autocompletion now)
Cleaning the project
Uncommening .pch file back
Rebuilding project
Now you should be able to see correct syntax highlighting and auto completions should be correct.
What the hell was that? I was not receiving any File not found error from the compiler. Fixed that one by removing some missing file links from UnitTest and UITestTarget from Compiler Sources on Project's Build Phases.
Deleting only the Derived Data of the project that is failing is not enough
I had to delete all Derived Data of all projects, did a Clean project and restart Xcode
Amazing