Why in Xcode 6 doesn't work Assistant Preview? - swift

Sometimes in Xcode 6 Assistant Editor -> Preview stops working.
Showing just "No selection" even if no errors and Storyboard is ok.
Why does this happen?

The reason is "?" (questionmark) in Project's name (maybe there is a bug with other symbols – didn't check it).
You can try to rename Project or just create new one with name without "?" in it.

You must to Kill Xcode from processes for complete and then open it again. You can do it with Activity Monitor o CLI. Voila! - Preview is working again.
Don't just close Xcode keeping the app working. Sometimes also works closing with CMD + Q.

I had similar problem, but fixed it
You must open the xib or storyboard file in both assistant editors. Click the navigation button in the second editor (either the bottom or the right editor, depending on how you stack the assistant editors) and choose Preview to get the preview to appear.
thanks to
http://meandmark.com/blog/2014/09/xcode-6-no-simulate-document-in-interface-builder/comment-page-1/#comment-2883

I have played with Xcode 6 for a while and I encountered similar problems occasionally. I never used special characters in project or class names but the problem sometimes happens.
Now I have to test all ViewControllers at starting point to see if the Assistant Editor work. If not, I will just delete the class file and recreate the same one, it usually fix the problem.
Hope this can be fixed soon.

Related

Get rid of file icon shadow when file is not saved in Xcode

When a file was just edited and not saved in the Xcode editor the icon of the file in the right pane is darkened a little, and because I have OCD this drives me absolutely crazy and I end up having to click Ctrl+S every time I do anything as simple as commenting a line of code or moving a button 1 pixel in storyboard.
I am using Xcode 10.1 Beta 2, but this happens in all versions of Xcode.
How do you make it so the file is never darkened?
I have the same problem in Xcode and I always command s everything as well. I have looked for a way to disable this, but for now I don’t think there is a way... Maybe they’ll add a way to turn this off in another update soon :)

Visual Studio Code window is not appearing

I've encountered a very strange bug with Microsoft Visual Studio Code. I've been using VSCode for a few months now and never had this issue. When I open VSCode, the window just doesn't appear. The app is definitely open, because when I hover over the icon on my taskbar I can see what is being displayed in the app:
Unfortunately, when I click on it, the window does not appear.... I've uninstalled and reinstalled, deleted cache, tried older versions and nothing has worked. Has anyone else encountered this and fixed it? Any advice?
hover over VSCode icon in taskbar
right click on it
click on "New Window"
That should do it.
I had something similar. It appears that the window is just off-screen. I've used my DisplayFusion display manager - to move windows to center/top where I could handle it myself. I expect it'll also work using <Win> + <←> (maximize window to left side of screen).
In my case, the issue went away when uninstalling the GlassIt-VSC extension. I tried modifying the opacity of the window and then it disappeared. I highly suggest you try uninstalling this extension.
In my case I had connected HDMI cable but due to power off my monitor was off, but when I disconnected hdmi cable; VS code visible on my screen.
Got the answer since no one was helping.
Go to view.
Click solution explorer.
It should show the name of your project.
Click the small arrow at the beginning of the heading of your project.
Click source files.
Click yourproject.cpp.
Thank you.
I encountered a similar issue with a plugin called GlassIt while I was playing with a property called "glassit.alpha" somehow it went to 1 (possibly I changed it accidentally) and nothing showed up. (here's an image where you can slightly see that I set alpha to 20)
what i did was to just edit the %appdata%\..\Roaming\Code\User\Settings.json and set "glassit.alpha": 1, to 255
UPDATE I just realised there was already an answer I didn't see while I was writing this post
I had this issue during a remote desktop session and could bring the VSC window back via hitting F11 (via the onscreen keyboard in my case, since the F11 key on my keyboard was being captured by the host system).
In my case, I have a dual monitor setup, and the laptop was in clamshell mode. However, the laptop's built-in monitor was recognized as a third monitor, and VsCode was going there.

Can't drag outlets from Storyboard to Assistant editor in XCode

I used to be able to do this in XCode, and now suddenly I can't in a new project I've opened that was sent over by a friend.
Is there a particular setting I have to change to start this again?
I.e. there is a textbox I want to link via Code, and now I just can't. :(
Need help guys!
You most likely have an assistant editor window opened to a wrong class, you will need to check on your currently selected view controller and make sure that its the same that is opened in the assistant editor
Or in assistant editor, select automatic (check screenshot)
The solution for me was simply to press Ctrl while dragging...
I was having the same issue and looked all over and couldn't find a good fix to the problem. What was happening when my Controllers were first generated they had the generic names FirstController. When I switched the names I didn't switch the value in the Custom Class area. To fix:
Select View.xib
Select File's Owner under placeholders. This should be on the left side of the screen with a yellow cube next to it.
Select the third option on the utilities menu (Identity)
Change the Custom Class class to the correct Controller name.
I know this wasn't the specific question's issue but I clicked on this question a few times so thought if someone had the same issue it might be helpful.
With the latest version of Xcode when I open up the Storyboard and .h file, I remove the last space below the #end tag on the bottom of the (fresh) .h file. Which for some reason wouldn't let me place the outlet after doing so, thanks Apple!
So to fix my problem i have to have that extra space below the #end tag in the .h file.
This is what fixed my problem and I know it doesn't answer this specific question but hopefully, it helps someone.
I had the same problem, In my case there was a mismatch between my class name at the identity inspector and that one at source code.
Had this issue too.
XCode 9: make sure in the Storyboard -> Identity Inspector -> "Inherit from Module from Target" is checked (or fill out the module name manually)
EDIT: Turns out checking that box doesn't help -- if you delete the class of the UIViewController, then type it in manually and hit Enter, in XCode 9 if there's a problem the checkbox "Inherit Module from Target" will not auto check itself. After trial and error it turned out in the class (Swift 4), there was a #if IDENTIFIER .... #endif which was perfectly valid, but screwed up Storyboard connections some how. After removing it, typing the class name in the storyboard auto-checked the box, and now connections work. Yay another XCode 9 bug.

nslog stopped working in xcode

I have a strange issue and possibly a bug. My NSLog statements have stopped working completely, they do not print even in view did load, application didfinishlaunching etc. The have all turned a brown colour (the same colour as a pragma mark in xcode) and they all have a warning saying 'expression result unused'. Has anyone ever seen this before or know what to do? Am i running in some kind of weird mode? Im running xcode 4.0.2.
Many thanks
Jules
for completeness, I had the same problem and the answer was different, hope it helps someone else who bumps into this post:
I had a framework (an Amazon one) redefining NSLog, went there (Cmd+Click on the Brown NSLog) and commented out the redefinition...
The actual problem was the release_build set to 1. So it wasn't recognizing nslog, as you said it was set for a release build.
I had the same issue :
what worked for me is given below:
Remove the derived data folder
After removing derived data perform the clean action (You can see this option in the product menu)
Quit the Xcode and start it again.
And this did the trick all my NSLog were working fine.
Hoep this helps
Ensure that scheme chosen corresponds to Debug mode because sometimes the pch file might have some definitions such that logging is done only in the debug mode
(Scheme is on to the left of the place where you select iPhone Simulator / iOS Device)
In the view select Debug Area
(There are 3 view buttons, on the top right hand corner of Xcode, press the center button)
Select "Show variables view and the console"
(In the debug area (bottom) there are ther 3 buttons, press the center button)
I had the same issue and the problem was that I was building an Ad Hoc version (schema was for Ad Hoc build). The warnings disappeared when I built for debug.
Try changing the dropdown menu at the bottom of the console to 'All Output'.
if you are using libraries like 'KScan' or 'iKEA' or 'kdc-scan', so it can happens that, they will call methods like this one 'redirectNSLogToDocuments'.
in my case the object of 'iKEA' call the method 'CheckIfDeviceConnected' and this one redirect all nslog outputs to documents. after commenting out, all nslogs works again :)
hope this will be useful for some one.
some steps :-
1) "Clean all targets" or delete your build and rebuild again.
2) If step 1 doesnt work , reinstall xcode

Xcode's Refactor menu is always disabled

For some reason Xcode's Refactor is always disabled. I used to be able to activate it via selecting a class name and right clicking in the editor to select it. But now no matter what I do, it remains disabled. Any idea what's going on?
Working with Xcode 5, I kept getting "Can't refactor during indexing" when trying to refactor. Rebuilding the index seemed to hang at "Indexing - Waiting for make" forever.
I then noticed that make was already used by another process on my machine (not by Xcode). Shutting this process down enabled Xcode to finally finish indexing
Your project's index might be out of date/corrupt. In the General tab of the Project Settings window, click Rebuild Code Index and wait until it's done.
You can check the progress of the rebuild in the Activity window (Window > Activity).
I just ran into a similar problem in Xcode. I could not refactor anything in the class's .m (implementation file). The only explanation I could come up with is that it was not indexing the file for some reason, and I could not force it to reindex. The only hack that I found that worked was to copy the file to temporary location, remove it from my Xcode project, copy the file from the temp location back to my project's location, and then re-add the file via Xcode.
None of these suggestions work for Xcode 3.2 - the ONLY way is to select the file you want to rename in the left Groups & Files column. THEN highlight the name of the .m or .h in the right code view, then you can right click and select Refactor!
For instance if you're changing the DetailViewController name, highlight the actual DetailViewController.h word in code.
Note, you should also always make sure you've selected the .h file, not the .m
I faced the same thing in Xcode 11. and this worked for me:
I changed iPhone 8 simulator to generic iOS Device and it worked when it is on Generic
I'm new in iOS development,I have met this similar problem.
Xcode:Version 7.1 (7B91b),it looks like Refactor not working:
But when I put my mouse on the red circle point in the following picture,and then the Refactor working.
I think this is a low level mistake,but may be a reference for someone.