Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Incomplete Implementation in Objective-C Class

Tags:

objective-c

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 
like image 599
Chandler Davis Avatar asked Apr 01 '26 08:04

Chandler Davis


2 Answers

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
}
like image 57
kasrak Avatar answered Apr 03 '26 21:04

kasrak


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!

like image 28
Hardik Shah Avatar answered Apr 03 '26 22:04

Hardik Shah



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!