Reputation: 37
I am Following a tutorial at http://www.raywenderlich.com/14172/how-to-parse-html-on-ios .
Here is my detailviewcontroller.h file.
#import <UIKit/UIKit.h>
@end <-- //errors shows up here.
@interface DetailViewController : UIViewController
@property (strong, nonatomic) id detailItem;
@property (weak, nonatomic) IBOutlet UILabel *detailDescriptionLabel;
@end
This is my detailview.m file
#import "DetailViewController.h"
@interface DetailViewController ()
- (void)configureView;
@end
@implementation DetailViewController
#pragma mark - Managing the detail item
- (void)setDetailItem:(id)newDetailItem
{
if (_detailItem != newDetailItem) {
_detailItem = newDetailItem;
// Update the view.
[self configureView];
}
}
- (void)configureView
{
// Update the user interface for the detail item.
if (self.detailItem) {
self.detailDescriptionLabel.text = [self.detailItem description];
}
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
[self configureView];
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
self.title = NSLocalizedString(@"Detail", @"Detail");
}
return self;
}
@end
As i referred above, the @end error message appears and wait to auto fix in red square, the i agree to do the auto fix. Then the xCode applies the @end code over there, as shown in the .h file. Then an other error appears as which is in the title " @end must appear in an objective-c context "
what should i do ? Is xCode gone mad or what.
Whats wrong ?
Upvotes: 0
Views: 9434
Reputation: 31
In my case, somewhere along the line I missed a @end in one of the .h file. So all files that import that .h file is prompting this error. The funny thing is, I don't receive this error message on the one .h file that does miss the @end. So I guess you need to do some searching make sure you close all your @interface, @implementation or @protocol with @end. Hope that helps.
Upvotes: 3
Reputation: 185721
Just remove that first @end
. It's completely wrong. You can only have @end
after an @implementation
, @interface
, or @protocol
declaration.
Upvotes: 1