Pragma Mark Problem


The #pragma mark does not work as described in the book - it doesn’t group the methods in a “Application delegate callbacks” section. Upon investigation a #pragma mark will not work if placed before the first method in XCode. This is the case in the book example. To remedy this place empty curly braces before the #pragma mark or place the #pragma mark in curly braces like so:

#pragma mark - Application delegate callbacks

#pragma mark - Application delegate callbacks


You shouldn’t have to do that.

Works fine over here.

This code:

[code]#pragma mark - Some Group.

#import “SomeSillyClass.h”
@implementation SomeSillyClass

  • (void)someSillyMethod {

#pragma mark - SomeOtherGroup

  • (void)someOtherSillyMethod {


Note that the second mark is indented because it appears -inside- the @implementation block.


Maybe a bug in XCode? I am running 4.5.2 and it doesn’t work when you put the pragma mark before the first method. When I put it before the second method it works fine without curly braces. If it works fine on your end perhaps there is a setting in Preferences that I have wrong.


Same problem here. Works fine if I put it anywhere except right after the @implementation. Inserting {} between @implementation & #pragma fixes the problem.


Ran into the same issue with Xcode 4.6.1. #pragma directly after the @implementation doesn’t seem to work.


Same here, the only way to solve this is to use the curly braces proposed by OP.
#pragma mark - Your title


As with others - I get the same here. Using latest version of xCode 4.