Xcode: a este método le falta un divisor correcto antes

- (void)setDelegate:(id<MyDelegate>)delegate {
  _delegate = delegate;

  if (_delegate) {
    self.navigationItem.rightBarButtonItem =
    [[[UIBarButtonItem alloc] initWithTitle:@"Close"
                                     action:@selector(closeView)] autorelease];

- (void)closeView {
    [self.navigationController dismissModalViewControllerAnimated:YES];
    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault animated:NO];
    self.navigationController.navigationBar.translucent = NO;
    self.navigationController.navigationBar.barStyle = UIBarStyleDefault;

The line "- (void)closeView {" is marked yellow in XCode 4 and the warning is: "This method is missing a correct divider before it".

What does this warning means?

preguntado el 08 de noviembre de 11 a las 12:11

Please show the code directly above this code in your file -

I edit my question and add more code -

3 Respuestas

I had to add "//////////////////" in the line before the method!

- (void)closeView {

My code is inside "TTThumbsViewController" of the framework Three20. Before every method are these slashes: https://github.com/facebook/three20/blob/master/src/Three20UI/Sources/TTThumbsViewController.m

respondido 08 nov., 11:16

This seems to be some kind of syntax checker in Three20 to make sure each method has those slashes before it. If you add them it should solve the problem. - AndyDunn

Try to change that method to

- (void)closeView:(id)sender{

respondido 08 nov., 11:16

You are correct with your code, but unfortunately there's still the same warning. - Manni

Xcode does not see a proper "divider" meaning (probably) that the white space is something else than the required newline. Delete and re-type the code including the closing curly braces through the method starting line.

Or examine the lines in another editor that has a mode to show all the characters such as TextWrangler (free from Bare Bones Software).

respondido 08 nov., 11:16

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.