1 2 Previous Next 25 Replies Latest reply: May 5, 2012 10:22 AM by andyzoom01
QuadraQuack Level 1 Level 1 (0 points)

Hello,

 

I'm following the "Your First iOS Application" (a.k.a. iPhone 101) and under Chapter 5 on page 40 (of the PDF) where it instructs me to create an action for the button in the nib file named "changeGreeting", I'm getting the following error:

 

Could not insert new action connection: No @implementation found for the class "MyViewController"

 

I'm not a programming noob, but I'm new to iOS/Mac programming (I've been developing Windows applications for almost 11 years). I followed the guide very carefully up to this point and everything was working until this.

 

I'm using the latest version of Xcode (4.02).

 

It seems to be complaining that it isn't aware of MyViewController, but I don't understand why. Any help would be most appreciated. Thanks.

  • 1. Re: iPhone 101 guide error
    K T Level 7 Level 7 (23,700 points)

    Check your code for uses of MyViewController versus myViewController - see this thread:

    https://discussions.apple.com/thread/2396194?threadID=2396194&tstart=0

  • 2. Re: iPhone 101 guide error
    Squench Level 1 Level 1 (0 points)

    I am also receiving the same error. The thread supplied did not resolve my problem.

     

    I am very keen to find a solution, any help is appreciated.

     

    Thank you!

  • 3. Re: iPhone 101 guide error
    thnbgr Level 1 Level 1 (0 points)

    Got the same error.  Any help or update?

  • 4. Re: iPhone 101 guide error
    QuadraQuack Level 1 Level 1 (0 points)

    The capitilization problem described in the link above does not appear to be the issue.

     

    Here is the code for MyViewController.h:

     

    #import <UIKit/UIKit.h>

     

     

    @interface MyViewController : UIViewController {

     

    }

     

    @end

     

     

     

    This is the code for MyViewController.m:

     

    #import "MyViewController.h"

     

     

    @implementation MyViewController

     

    - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil

    {

        self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];

        if (self) {

            // Custom initialization

        }

        return self;

    }

     

    - (void)dealloc

    {

        [super dealloc];

    }

     

    - (void)didReceiveMemoryWarning

    {

        // Releases the view if it doesn't have a superview.

        [super didReceiveMemoryWarning];

     

        // Release any cached data, images, etc that aren't in use.

    }

     

    #pragma mark - View lifecycle

     

    - (void)viewDidLoad

    {

        [super viewDidLoad];

        // Do any additional setup after loading the view from its nib.

    }

     

    - (void)viewDidUnload

    {

        [super viewDidUnload];

        // Release any retained subviews of the main view.

        // e.g. self.myOutlet = nil;

    }

     

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceO rientation

    {

        // Return YES for supported orientations

        return (interfaceOrientation == UIInterfaceOrientationPortrait);

    }

     

    @end

     

     

     

    As you can see this is nothing but the stock code that comes with first creating the file according to the instructions in the guide. If this is a bug in Xcode 4.02 then it's definitely not ready for primetime. I hope I've done something wrong or there is something missing from the guide. Please help us.

  • 5. Re: iPhone 101 guide error
    QuadraQuack Level 1 Level 1 (0 points)

    What's even stranger is that I can manually type in the code that this action was supposed to create for me and THEN if I right-click-n-drag to the declaration in the header file to connect it, it doesn't complain and builds just fine.

     

    (The code is described on pages 40 and 41 of the PDF version of the guide, right after telling you to drag from the button to the header file in assistant view)

     

    Question: Long ago I changed one of the settings for Xcode 3.x to put the brackets on the following line, since that's how I like it stylistically. It's a long shot, but for anyone else having this same error, did you perhaps do the same thing?

  • 6. Re: iPhone 101 guide error
    TTGator Level 1 Level 1 (0 points)

    Same problem here.  No solutions yet I assume?

  • 7. Re: iPhone 101 guide error
    TTGator Level 1 Level 1 (0 points)

    Well I'm not sure exactly what caused this, but I can tell you what I did that possibly created the problem.  I created a new->file that was a ViewController and made some changes.  Then I removed the 3 files that were generated for me because I had just created it to show someone how easy it was to create a UI.  The next day I created the ViewController again with the SAME NAME, and the problem we're talking about started happening.  Did anyone else do this same thing?

     

    Anyway, I created another new ViewController with a different name, and everything seems to work just fine.  So maybe it's an XCode 4.02 bug if you delete then recreate using the same filename? Just a theory.

     

    -Aaron

  • 8. Re: iPhone 101 guide error
    james957 Level 1 Level 1 (0 points)

    I'm having the same problem.  I had deleted and re-created new files with the same name as well.

  • 9. Re: iPhone 101 guide error
    QuadraQuack Level 1 Level 1 (0 points)

    To everyone experiencing this issue, I wanted to say that I'm pretty sure this is a bug in XCode 4.0.2. What exactly is causing it I don't know, and I hope that Apple is looking into it because it's certainly frustrating. (Not to mention the fact that for newcomers it leaves a bad impression.) All I can say is to type out the code yourself, and it will work, and you can finish the tutorial.

     

    In fact after typing the code out yourself for the first one, the linking method that the tutorial uses appears to work after that. Hopefully Apple will fix this bug soon.

  • 10. Re: iPhone 101 guide error
    frenchef Level 1 Level 1 (0 points)

    Hi,

     

    Im going through the steps of the tutorial and ran into this exact problem.

     

    I was able to fix the problem by exiting from Xcode and restarting it.

     

    On restart of Xcode everything worked fine.

     

    A funny little thing in Xcode i guess.

  • 11. Re: iPhone 101 guide error
    danielson317 Level 1 Level 1 (0 points)

    I spent about 20 min debugging this and found that I had an error in the header file that said "incomplete implementation" on my @implementation line. I finally fixed it by moving the bracked on the @intervace line

    From:

     

    @interface MyViewController : UIViewController {

    }

     

    To:

     

    @interface MyViewController : UIViewController

    {

    }

     

    It would appear xcode is a bit sensative to bracket placement.

  • 12. Re: iPhone 101 guide error
    professortodd Level 1 Level 1 (0 points)

    I had this same problem and I solved it by saving my header file MyViewController.h

  • 13. Re: iPhone 101 guide error
    brianvaughn Level 1 Level 1 (0 points)

    Any update here? I'm not reading through the tutorial that others on this thread seem to be following, but I've tried the various "fixes" mentioned in this thread and I'm still having no luck.

  • 14. Re: iPhone 101 guide error
    Richard Downey Level 1 Level 1 (25 points)

    I solved this problem by exiting and restarting XCode and waiting for it to index all of the files in my project before trying to add my new outlet.  I think that XCode wasn't able to index the files for some reason (simulator running maybe?)

1 2 Previous Next