Help Building, Getting 2 errors

Discussion in 'iOS Programming' started by FubsyGamr, Dec 5, 2010.

  1. FubsyGamr macrumors regular

    Joined:
    Sep 20, 2010
    #1
    Hey guys;

    I am currently following along with a teach-yourself book called "Sams Teach Yourself iPad Application Development." So far it has been going great, but now I've run into a problem. The gives two codes to type out then try to build (it's on pages 161-162) then create the interface with Interface Builder. Everything went good (I thought) but when I tried to 'point' from Files Owner to any of my text fields, in the Interface Builder, it wouldn't give me any outlet options. Confused, I tried to only 'build' the code that I had typed in Xcode, and I got two errors. I'm hoping that you guys will be able to help out:

    Code:
    [B]FieldButtonFunViewController.h[/B]
    
    
    //
    //  FieldButtonFunViewController.h
    //  FieldButtonFun
    //
    //  Created by Julian Ontiveros on 12/5/10.
    //  Copyright 2010 SLCC. All rights reserved.
    //
    
    #import <UIKit/UIKit.h>
    
    @interface FieldButtonFunViewController : UIViewController {
    	IBOutlet UITextField *thePlace;
    	IBOutlet UITextField *theVerb;
    	IBOutlet UITextField *theNumber;
    	IBOutlet UITextView *theStory;
    	IBOutlet UITextView *theTemplate;
    	IBOutlet UIButton *generateStory;
    
    }
    
    @property (retain,nonatomic) UITextField *thePlace;
    @property (retain,nonatomic) UITextField *theVerb;
    @property (retain,nonatomic) UITextField *theNumber;
    @property (retain,nonatomic) UITextView *theStory;
    @property (retain,nonatomic) UITextView *theTemplate;
    @property (retain,nonatomic) UIButton *generateStory;
    
    
    -(IBAction)createStory:(id)sender;
    
    @end
    
    
    Code:
    [B]FieldButtonFunViewController.m[/B]
    
    
    //
    //  FieldButtonFunViewController.m
    //  FieldButtonFun
    //
    //  Created by Julian Ontiveros on 12/5/10.
    //  Copyright 2010 SLCC. All rights reserved.
    //
    
    #import "FieldButtonFunViewController.h"
    
    @implementation FieldButtonFunViewController
    
    	@synthesize thePlace;
    	@synthesize theVerb;
    	@synthesize theNumber;
    	@synthesize theStory;
    	@synthesize theTemplate;
    	@synthesize generateStory;
    
    /*
    // The designated initializer. Override to perform setup that is required before the view is loaded.
    - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
        self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
        if (self) {
            // Custom initialization
        }
        return self;
    }
    */
    
    /*
    // Implement loadView to create a view hierarchy programmatically, without using a nib.
    - (void)loadView {
    }
    */
    
    
    /*
    // Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
    - (void)viewDidLoad {
        [super viewDidLoad];
    }
    */
    
    
    // Override to allow orientations other than the default portrait orientation.
    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
        return YES;
    }
    
    - (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.
    }
    
    - (void)viewDidUnload {
    	// Release any retained subviews of the main view.
    	// e.g. self.myOutlet = nil;
    }
    
    
    - (void)dealloc {
        [super dealloc];
    }
    
    @end
    
    The errors are:
    and
    They both 'appear' and the "@end" of the .m code

    I have gone over it 100 times and I am positive I typed it in 100% like the book shows (I even wiped it all and started over, just to be sure) but it's not working.

    Any/all help would be greatly appreciated. Thanks!
     
  2. FubsyGamr, Dec 5, 2010
    Last edited: Dec 5, 2010

    FubsyGamr thread starter macrumors regular

    Joined:
    Sep 20, 2010
    #2
    Well, I sure feel silly now, because I was able to find the answer. I downloaded the example code from the website and noticed that, in their .m file, they also have a

    Code:
    -(IBAction) createStory:(id)sender {
    }
    Even though the book doesn't say so. Adding that line of code and then building fixed my problem 'building' the code, and opening a different control file (FiledButtonFunViewController.xib) fixed it all up for me.

    Sorry guys, but thanks to those of you who would have answered.
     
  3. NickFalk macrumors 6502

    NickFalk

    Joined:
    Jun 9, 2004
    #3
    Good for you that you found a solution yourself, but this might be a good time to stop and consider the information you received and what it actually meant:

    Incomplete implementation of class 'FieldButtonFunViewController'

    Clearly tells you that the implementation file is missing a method defined in the header-file. The "other" error was Method Definition for '-createStory:' not found is clearly connected to the first warning you received, actually telling you what was missing.
     
  4. CYnthiaBlue44 macrumors newbie

    CYnthiaBlue44

    Joined:
    Dec 17, 2010
    Location:
    Sydney
    #4
    Thanks for your clear and precise explanation

    Thanks soooooo much for sharing your problem and then solving it. I've spent a few hours today re-doing and re-doing the example. I realised that there was an error in the book because I had the "live" example, however I was still struggling. I worked it out once I saw your post where you mentioned opening "a different control file (filedButtonFunView Controller.xib)". That was the bit that fixed it for me. I can now move on to the next example.
     

Share This Page