Studie
Studie

Reputation: 799

A fail concerning the expression @autoreleasepool

I downloaded a sample code from developer.apple.com called SimpleGestureRecognizer and in the main.m the program send a fail, because the program does not know the expression @auoreleasepool

The fail is: Unexpected '@' in program. I searched on the internet, if there is a same problem happens to someone, but there was nobody having the same problem.

Do you know, why this program does not know the expression @autoreleasepool? My Xcode version is 3.2.6

Thank you for your help and presumptions in forward

Upvotes: 3

Views: 3924

Answers (1)

user557219
user557219

Reputation:

@autoreleasepool was introduced in LLVM 3.0, the compiler available in Xcode 4.2. Since you’re using Xcode 3.2.6, you have LLVM 1.6 and GCC, neither of which recognises that directive.

You can change the code to use NSAutoreleasePool instead of @autoreleasepool so that it builds with Xcode 3.2.6. For example, replace:

@autoreleasepool {
    …
}

with:

NSAutoreleasePool *pool = [NSAutoreleasePool new];
…
[pool drain];

Upvotes: 13

Related Questions