views:

176

answers:

1

Getting an error message "Nested functions are disabled, use -fnested" etc in XCode/ObjC.

Here's the code (balls is an NSMutableArray pointing at a bunch of UIViews).

CGPoint pos=[[self.balls objectAtIndex:pointidx] center];

But the following seems to compile ok.

UIView *ref=[self.balls objectAtIndex:pointidx];
CGPoint pos=ref.center;

Should I use "-fnested-functions to re-enable (and if so where do I put the "-fnested-functions")? Or should I just put up with additional step of creating a UIView* pointer first? ty.

+1  A: 
David Kanarek
You are completely right, I need to check my syntax before I jump to ask questions! A missing semi-colon on a previous line. thanks...
Nigel
Again not a problem. Xcode has some very strange ways of telling you when you do something wrong. It got a lot better recently, but it can still be puzzling. Also, clang is now built in, so if you have trouble with the compiler warnings, clang can sometimes be clearer about the problem. Use Build > Build and Analyze to see clang's report. Also useful for detecting memory leaks and dead code.
David Kanarek