0

I have just recently begun learning about app development, although I am quite fluent in Java, C and Fortran. I want to make a simple iOS app that just prompts the user to input their name, and when they hit a button a label says Hi [insert name]. I believe I'm going about this the right way although every time I try to link the label to my viewcontroller.h file it gives me this error. I hav gone through so many forums online with people saying they fixed it by deleting the derived data, restarting, reinstalling and what not. I have tried all of those numerous times. I've even uninstalled and reinstalled xcode twice. I was wondering if there are any other problems that could be causing this?

It looks very similar to this:

enter image description here

Thanks

βhargavḯ
  • 9,786
  • 1
  • 37
  • 59
  • Try inserting the outlet using traditional way by declaring @property(nonatomic,strong) IBOutlet UILabel *myLabel; in .h file. And then using the connections inspector to connect the label on storyboard. – mak Dec 18 '13 at 05:55
  • I realize it's pretty much the same problem, but none of the solutions on that post have helped at all, I still get this issue. Also I tried using the traditional way but using the connections inspector I don't get much (im still pretty new as well). I drag the outlet connections of my label to the .h but nothing happens – TylerKal Dec 18 '13 at 06:01
  • I did a "Clean" and "Build" under "Product"! This helped for me! – pawi Feb 02 '15 at 09:16

2 Answers2

1

enter image description here 1. Close your project. 2. Delete the DerivedData folder of you project. (project's folder, or inside ~/Library/Developer/XCode/DerivedData/(your project)/ ) or somewhere else that were setup by you. 3. restart your project.

Otherwise make sure Have checked the target when you created your second view controller

enter image description here

jailani
  • 2,260
  • 2
  • 21
  • 45
  • I've tried this countless times already. And the target for my seconviewcontroller.m is my application, but for the .h it won't let me select a target, is this right? – TylerKal Dec 18 '13 at 06:08
  • Have you done this during the creation of your secondViewController? Make sure do you have xib file for secondViewController? – jailani Dec 18 '13 at 06:11
  • this is gonna sound really bad but what is the xib file? Im really new to this kind of programming – TylerKal Dec 18 '13 at 06:28
  • I think you should have done...You ll be asked for create viewcontrollerwith xib file when you create your view controller.Please refer the image i have added. May be it could be the reason – jailani Dec 18 '13 at 06:41
  • I just tried, and I have my xib file which looks pretty much like a storyboard file, so do I use this instead of a storyboard? I was able to write @property IBOutlet UILabel *helloLabel; then link my label to that, but still the shortcut won't work – TylerKal Dec 18 '13 at 06:50
  • Can you check with out short cut? Is it working? – jailani Dec 18 '13 at 06:53
  • yeah i get a bunch of errors when compiling, and I can't drag my labels onto the code like I should be able to. I write this @property (nonatomic,weak)IBOutlet UILabel *helloLabel; but still nothing. And for some reason nonatomic, weak and UILabel aren't highlighted in other colours – TylerKal Dec 18 '13 at 07:00
  • Did your second view controller subclasses the UIVIewController? – jailani Dec 18 '13 at 07:07
  • I don't think so. I have my storyboard secondviewcontroller custom class set to seconviewcontroller and if I change that to UIViewController it won't even let my try to make a connection from a label – TylerKal Dec 18 '13 at 07:12
0

Just try that delete your secondviewcontroller and then recreate it.

Maulik Kundaliya
  • 452
  • 3
  • 17