In a project in XCode V8.2, using objective-c, I have created an object with a couple of properties. When I want to create a binding and start entering the property in "Model Key Path", IB shows me all available properties as expected and I can select the desired one. All is well.
On another Mac however, running XCode V9.2, this process does not work. I can enter a Model Key Path and the app compiles and runs without errors, but IB does not show me the available properties when I start entering the property name. When the name is complete (and correct), IB shows me a grey exclamation mark and a hint that it cannot find the Model Key Path.
Does XCode V9.2 and up require different/additional steps for this?
Related
So, since updating, the gui randomly hangs editing a xib file. The scenario goes like this:
click an object - i.e, array controller
expand a parameter, Filter Predicate here
Select target object in pull down
try to enter model key path - HANG
In different xib files, the hang comes when trying to enter the model key path textfield. I've also seen errors citing bogus fields like 'Hidden3' for some attribute bindings - only workaround was to remove them.
Has anyone ventured to editing the xml directly, but I guess I can do that in code :-(
Well, I know this is an old question, but I found an answer.
My situation was similar to the one described above: Xcode hanging whenever I edited the key path of any binding in Xcode 8.1. Nothing described here or elsewhere worked.
However, what did work was to edit the storyboard outside of the actual Xcode project: open the offending StoryBoard by itself, do not access it through the project.
This appears consistent with a Sample/Spindump through the Activity Monitor when Xcode hung that showed functions that appeared related to auto-completion/edition. Unchecking auto-completion did not work though (in Prefs).
I am trying to give an object in the interface builder a custom class. When typing in the class name in the Identity Inspector it automatically finishes the line as its already present in the dropdown list of available classes.
However after entering the class the page comes up with a padlock image and clears the class name.
What is the cause of this and how can I rectify it?
firstly, you must reload xcode
if it not work you must have subclass associate with it in IB
Create CustomClass:UITableViewCell then drop UITableViewCell to IB and then just type the name
If dropdown list not display, reload Xcode
Assuming you've specific the right IB object (e.g., a dynamic cell prototype, whose default class is UITableViewCell) and your custom class is defined correctly (as a subclass of UITableViewCell, itself), then I have a couple of thoughts of what you might try:
Sometimes exiting and restarting Xcode is often enough.
Also try selecting "Clean" from the "Build" menu (or press shift+command ⌘+K).
In the worst case scenario, sometimes you have to exit Xcode and delete the DerivedData folder and then restart Xcode. To find the derived data folder, press command ⌘+, (comma) and go to the last tab, "Locations", and click on the arrow next to the "Derived Data" folder:
Having pulled up that folder in Finder, quit Xcode, delete the contents of that DerivedData folder in Finder (after quitting Xcode), and then restart Xcode and try again.
I think I have found the solution (not sure if I have found a fix for the actual problem or just found a way around it)...
I changed the Lock dropdown setting to Nothing and it now allows me to set my own custom class to the Object in the file.
Whats strange is that the document lock was previously set to Inherit (Nothing) anyway so not sure what the difference is here.
I have an Xcode 4 objective-C project which contains about 150 .m and .h files in it.
The code underlying the project does not always correspond in underlying disk structure to the folders shown in the Xcode project. I get that part.
What I don't get is why Xcode won't tell me anything about why I can create new project groups and move items to them, with no problems, but certain existing project folders will cause the project to become broken, and the code will no longer build once I move certain .m files or .h files into a different group. When its broken it just shows the file in red. This is frustrating and confusing.
In the screenshot below, the left side of image before shows state before, when all is good, right side shows red (missing) file after moving into a group. Given that groups don't represent a folder on disk, I would not expect moving from one group to another to break things. Sometimes it does, and sometimes it does not. This particular XCode issue upsets me a lot.
In the good old days of Friendly Mac User-Interfaces, you could hit ⌘+I and get some information about the properties of objects, or right click and get to the properties of something via its context menu. Groups (folder icons) in XCode projects have no properties item in their context (right click menu) and yet these groups all clearly NOT all alike. What's up with these identical looking groups?
Secondly, how does a person learn how to reorganize both the on-disk-folder-organization and the visual group organization, in a way that does not leave you bloodied and beaten? (XCode 4 is the most difficult IDE version I have ever used, for this, I'm sure I've missed some important documentation on dealing with folders and files and so on.)
Update: The File Inspector (Identity Inspector in Utilities menu) is the key to this mystery, but exactly how a new user is to discover this (other than by painful experience) is still unknown to me. I also don't really understand what all this is about, with various choices available in the Path drop-down, and the blank or non blank value that has no description or help, just a cryptic icon and either a name of some real on-disk-folder or else a gray text field saying None:
This sort of thing doesn't just happen out of the blue. In this case, what has happened is that a user has opened an .xcodeproj and is unaware of the difference between the various relative or absolute Path options that a Group can be a part of. A Group in XCode is always shown with exactly the same manilla color folder-icon inside your XCode project, no matter what modes or properties it has defined inside of it.
By default the simplest case is that you create a new folder Group object in XCode and it's purely a cosmetic organizational tool that has no disk location information stored in it.
This is not the ONLY thing that these groups do, and not the only "mode" that these groups can be used in. These groups can also be used to point at some folder and say "things that are in this virtual folder are really somewhere else, either underneath this project's main folder in a subdirectory, or even up somewhere else on your hard-drive, either stored in relative path, or absolute path format". When used like this, these things remind me of a Windows "Shortcut" object on the desktop, or a Mac "Alias" object in the finder.
Dragging a file from one group to another does not move it to a different folder on the disk. It simply moves a reference to a file with a certain name, to another group, which might mean that after you drag a file, you haven't really moved it, or copied, or relocated it in any way, you've just moved an alias from a place where it could resolve properly to a real file, to a place where it can't. Thus XCode helpfully turns it red for you, without any helpful error message about what happened.
How do you fix it? In this case, go to the Identity inspector pane in the Utilities menu, and either decide to clear out the bogus value in the place where I have shown in the picture in the original question where I had "Classes". Clearing out a value that is invalid is not exactly easy to do because XCode requires that you basically find the root folder of your project and select that, and that will 'clear" the relative or absolute path property on your folder-group.
Alternatively, you can leave the folder alone, and just don't drag files from group A to group B without first checking what relative or absolute path they reference.
What still seems horrible to me is that XCode tutorials tell you to "use XCode to manage your project's contents, don't just drag files around in the finder inside an XCode project directory", and that's good advice, but it leads me to assume that XCode provides full and intuitive physical (and virtual) group-folder organization tools. It does not. As an example, imagine you inherit a project that has .m and .h files scattered through four physical folders underneath the main XCode project folder and you want to move those files around. You have to do a combination of tricky things inside XCode, and either in Terminal or in the Finder, in order to reorganize your folder. With the complications involved in moving items around in your version control tool of choice added upon the top of that, and XCode's very limited support for only Git and Subversion, you have a really tricky mess.
Ok, this is a pretty weird error. I have a UIViewController subclass and an associated Xib
It's part of an inherited project built originally by an outsourcer and a lot of properties and methods have badly spelled names, categorys instead of categories, merchantes instead of merchants, don instead of done and so on...
Mostly refactoring these has been straightforward, and XCode's symbol rename refactoring tool has handled them ok.
However with the xib and controller in question, after refactoring, there are some runtime errors, namely this class is not key value coding-compliant and unrecognised selector errors, which both name the old IBOutlet and IBAction names.
When grepping for the names, they don't appear, and searching specifically in the xib as XML source, they also don't show up.
I've worked around this by adding in the two offending symbols, while maintaining the references and all other calls to the corrected names. (ie. the old names don't link to any other code or xib references.)
The question is, why and where are these old symbol names being called?
(note: all IB references have been checked, and the project has been cleaned several times.)
Here's the references in question (correctly mapped in IB.)
And the connections showing in the source view...
Note the old references "navTitleLavel" and "donAction" are the throwing the errors if they're removed from the source, although they do not show as connected in the margin.
Now fixed
(without doing anything, assume a cache held the symbols)
See my answer below, it appears that the symbol references were being cached somewhere, and without additional action the errors are no longer being thrown (when removing the old name references.)
Note, this was resistant to cleaning the project.
I've run into such weird errors before and solved it by
Clean the project (Command + K).
Check every connection in IB so that they do not link to old stuff (don, categorys etc)
Restart xCode. (Really quit the application and restart it)
Hope it helps!
I ran into this problem as well, and a simple clean isn't always enough to get rid of the remaining references which may be in cached files on your device. Make sure to actually delete the app off the iOS device or reset the simulator if a simple clean doesn't solve the problem.
Despite numerous cleans and triple checking that grep, ack, ag and XCode's project wide text search could not find the references throwing the error. The error persisted.
However, this morning I tried again, and lo and behold the ghost references no longer throw the errors.
It appears that there is some sort of nib reference caching which persists after Project Clean, but expires after x time.
Note: the clean operation was run in excess of 10 times, without fixing the error.
I've also updated the question to provide some illustrative detail.
I am working on a VB NET project and had the strangest thing happen.
I created a class file(just like a dozen or so I have already created). I wrote in the code to access it. The autocomplete found the class, filled it in and colored it blue, just as it should.
But, when I run the app, I get a type is undefined error.
There is nothing in the class yet. And there is really no code to post..it is as straight forward as I described.
I tried restarting VS; Deleting and recreating the class; Deleting the class and creating a new one with a different name.
Is there something in the VB NET configuration I can check to see if it is not being added somewhere?
lee
Ok. I found the problem. I have 2 projects in one solution. They both share some classes that were trying to use my new classes. When I hit F5, both projects are compiled, and since I hadn't shared the classes with the second project, it errored.
So, now my question is changed; How do I specify to only build the specified Startup Project when debugging?
lee
Right click your solution -> properties -> configuration properties and untick everything you don't want to build.
And for your original question, check if build action on that files that don't compile is set to 'compile'