如何解決 'NSAutoreleasePool' is unavailable: not available in automatic reference counting mode

一個Object C 經典的hello world例子,在XCode 11版本里,報錯【'NSAutoreleasePool' is unavailable: not available in  automatic reference counting mode】。

#import <Foundation/Foundation.h>



int main (int argc, const char * argv[])

{

    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

    NSLog (@"hello world");

    [pool drain];

    return 0;

}

解決方法,如下圖:

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章