1

This is quite a major problem: the Outlets are not appearing in IB.

To reproduce:

1) I declare a variable to be IBOutlet, for example in my view controller's .h file

@property (nonatomic, strong) IBOutlet UILabel* testlabel;

2) I open the storyboard, click on the viewcontroller. - If this is a new project, there is no "Outlets" list. - If this is an old project with outlets already defined, the "Outlets" list contains the previous outlets, but not the one I've added.

Has anyone had the same problem. This is really important, as I can't basically proceed unless I stop using Outlets. I can't find any info about it on the release notes.

EDIT I'm adding a video on youtube showing the problem, in case I haven't explained it properly. If I'm forgetting something obvious, I'm happy to be laughed at :) That said, I've always been following these same actions and Outlets have always been in the list.

EDIT 2 For clarity, I've removed the ivar declaration as it seemed to get most of the attention.

Outlets on Youtube

EDIT 3 Ok I seem to be hitting a problem seen previously on this question and this other question. Basically, if I open the custom class drop-down, I see only some "standard" classes, such as UIViewController. If I select any of these, I get the Outlets. For example, for UIViewController I always have that view->View. However, my project's classes are not in the drop-down. Entering the name manually seems to work, but in fact it's not. There must be some indexing issue (except I've already deleted everything from

~/Library/Developer/Xcode/DerivedData/

without success. If you wish to try, I've put my code on GitHub. This doesn't show the Outlets for me, but it does for a number of other people - so it's not a "bug" with the code strictly speaking. It's more an XCode issue. Any help would be welcome!

EDIT 4 I think here's the problem, pretty much: look on the right. The drop-down menu doesn't show the "ViewController.h" class. If I enter it manually, it seems to recognise it but in fact I suspect it doesn't. In previous times, I was always seeing the full list of my project's classes in the drop-down menu. Class list is just generic

Community
  • 1
  • 1
puntofisso
  • 383
  • 1
  • 3
  • 17
  • That's an ivar. It's the way from before properties and still works if you don't want to synthesize the ivar. – uchuugaka Nov 16 '14 at 13:59
  • The ivar part of the code doesn't actually matter. The problem is that the property is an IBOutlet ant this is not showing in the list. I've added a video to make the issue clearer. – puntofisso Nov 16 '14 at 19:06
  • Can you try it with the beta seed of Xcode 6.1.1? – Matt Gibson Nov 16 '14 at 22:50
  • @MattGibson I'm downloading it as we speak :) I hope that solves the issue. But even if it does, a bit of curiosity as to how to "refresh" the list remains... – puntofisso Nov 16 '14 at 22:57
  • @MattGibson same issue with 6.1.1 too. I'm starting to get kinda desperate... – puntofisso Nov 16 '14 at 22:58
  • Can you reproduce it with a vanilla test project? Is it possibly the name ViewController is just to generic, what happens if you give it a more unique name? – uchuugaka Nov 17 '14 at 00:51
  • @uchuugaka it's not a code problem (see my "EDITS" above). It's an XCode caching issue. Anyway, I've found a solution. I'm going to report it. – puntofisso Nov 18 '14 at 08:50
  • Yeah. I think that will be fixed soon. There was a worse cache indexing problem in a previous build and it had workarounds and fixes. – uchuugaka Nov 18 '14 at 09:10

4 Answers4

4

I've found a "solution", or workaround. Deleting the XCode data is not enough, and it's not enough to just restart it. The following sequence makes the Outlets magically re-appear and work properly:

  1. Clean project
  2. Close XCode
  3. Delete all contents of ~/Library/Developer/Xcode/DerivedData/
  4. Restart MacOs

By doing this, when you re-open XCode and it reindexes, it will show the outlets as expected.

puntofisso
  • 383
  • 1
  • 3
  • 17
  • 1
    This is the only solution that worked for me. You'll have to follow the 4 steps EXACTLY. – Moe Salih Dec 14 '14 at 20:09
  • 1
    Just the sake of anyone reading: a possible "stupid problem" is exactly this: is **each class name / file name correct**? I had duplicated a class a few times, and I had failed to correctly name the classes/files. (So, I had two "CarCells", was missing a "BoatCell", and so on.) If you do such a thing, **exactly the problem discussed here** appears in Storyboard. Hope it helps someone! – Fattie Mar 20 '16 at 16:43
1

just declare the IBOutlet like this:

@property (nonatomic, strong) IBOutlet UILabel* testlabel
nburk
  • 22,409
  • 18
  • 87
  • 132
  • Yes - sorry, I didn't write here what I had in my code. I'll edit. – puntofisso Nov 16 '14 at 18:49
  • So, just to reiterate: I have the property declaring the variable as IBOutlet, exactly as in your example. I also have the ivar declaration. Now: for my old outlets (the ones I had declared before today) I have a corresponding entry in the "Outlets" list in the storyboard when I have focus on the View Controller; "testlabel doesn't show up. – puntofisso Nov 16 '14 at 18:52
  • Btw, I've edited the question and added a link to a video showing what the problem is. Happy to be told I'm doing something fundamentally wrong :) – puntofisso Nov 16 '14 at 19:07
1

Maybe a very dumb one, but have you tried Clean Project Folder, then deleting DerivedData (while Storyboard is not open), immediately quit Xcode, and opening up Xcode again, then building your project?

Can Poyrazoğlu
  • 33,241
  • 48
  • 191
  • 389
0

I ran into a similar problem, but it was due to a bug in Xcode (8.2) where Interface Builder doesn't show outlets in the Connection Inspector if those outlets have been declared with a _Nullable type annotation for Swift compatibility.

Using nullable inside @property's parentheses appears to work around the problem.

(I know the original poster's problem did not use type annotations or Xcode 8 so was slightly different, but the question summary matched my internet search so I mention this for future searchers.)

user2067021
  • 4,399
  • 37
  • 44