Chandler Davis
Chandler Davis

Reputation: 33

Incomplete Implementation in Objective-C Class

This is my ViewController.h, it is very short and simple so I thought this would work.

//
//  ViewController.h
//  Blue Bird
//
//  Created by Chandler Davis on 12/23/11.
//  Copyright (c) 2011 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <Twitter/Twitter.h>

@interface ViewController : UIViewController

- (IBAction)Button: (id)sender;
@end

And this is my ViewController.m, and it tells me that the "implementation is incomplete". What am i doing wrong?

//
//  ViewController.m
//  Blue Bird
//
//  Created by Chandler Davis on 12/23/11.
//  Copyright (c) 2011 __MyCompanyName__. All rights reserved.
//

#import "ViewController.h"

@implementation ViewController

- (void)didReceiveMemoryWarning
{
    [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, typically from a nib.
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
}

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
}

- (void)viewDidDisappear:(BOOL)animated
{
    [super viewDidDisappear:animated];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    if ([TWTweetComposeViewController canSendTweet]) {
        TWTweetComposeViewController *tweetComposer = [[TWTweetComposeViewController alloc]
                                                       init];
        [tweetComposer setInitialText:@"twit"];
        [self presentModalViewController:tweetComposer animated:YES];
    }
    else {
        UIAlertView *alertView = [[UIAlertView alloc]
                                  initWithTitle:@"error" message:@"unable to send tweet" delegate:self cancelButtonTitle:@"ok" otherButtonTitles: nil];
        [alertView show];
    }
    return 0; 
}

@end 

Upvotes: 3

Views: 6858

Answers (3)

renesteg
renesteg

Reputation: 571

I had the same warning and in my case it was an unused IBAction I forgot to remove, after I moved that feature from one view to another.

Upvotes: 0

Hardik Shah
Hardik Shah

Reputation: 1693

Because you have add this method

- (IBAction)Button: (id)sender;

in .h file but not in .m file thats why

Solution : either you can comment that line from the .h file or defined method in .m file.

This will solve the problem.

Enjoy!

Upvotes: 2

kasrak
kasrak

Reputation: 470

You need to actually implement the - (IBAction)Button: (id)sender; method defined in your ViewController.h in ViewController.m:

- (IBAction)Button: (id)sender{
   // Do things here
}

Upvotes: 4

Related Questions