NSAutoreleasePool is unavailable

前端 未结 5 1988
余生分开走
余生分开走 2020-12-05 23:13

I am following \"Programming in Objective-C\" 3rd edition and I am having problems with the first example.

I keep getting this error:

5条回答
  •  再見小時候
    2020-12-05 23:47

    The compiler is being asked to compile the file with ARC (automatic reference counting) enabled. Turn that off or, better yet, modernize your example:

    int main (int argc, const char * argv[]) {
        @autoreleasepool {
            NSLog (@"Programming is fun!");
        }
        return 0;
    }
    

    (No, I can't tell you how, specifically, to turn off ARC, if that was the route you were to go down due to the aforementioned NDA.)

提交回复
热议问题