gpt4 book ai didi

ios - 未声明的 NSAutorelease

转载 作者:行者123 更新时间:2023-11-29 02:56:17 25 4
gpt4 key购买 nike

我尝试使用 cygwin 和 THEOS 构建一个 ios 应用程序

教程: https://sites.google.com/site/theostutorials/home

经过几次尝试,我成功地完成了教程。最后我只需要运行命令“制作包安装”

然后我卡住了...

CYGWIN 终端:

ron_000@Laptop-Ron ~/projects/hello3
$ make package install
/home/ron_000/projects/hello3/theos/makefiles/targets/Cygwin/iphone.mk:38: Deplo
ying to iOS 3.0 while building for 6.0 will generate armv7-only binaries.

Making all for application hello3...
Copying resource directories into the application wrapper...
Compiling main.m...
main.m:2:2: error: use of undeclared identifier 'NSAutoreleasePool'
NSAutoreleasePool *p = [[NSAutoreleasePool alloc] init];
^
main.m:2:21: error: use of undeclared identifier 'p'
NSAutoreleasePool *p = [[NSAutoreleasePool alloc] init];
^
main.m:2:27: error: use of undeclared identifier 'NSAutoreleasePool'
NSAutoreleasePool *p = [[NSAutoreleasePool alloc] init];
^
main.m:3:12: error: implicit declaration of function 'UIApplicationMain' is
invalid in C99 [-Werror,-Wimplicit-function-decla`enter code here`ration]
int ret = UIApplicationMain(argc, argv, @"hello3Application", @"...
^
main.m:4:3: error: use of undeclared identifier 'p'
[p drain];
^
5 errors generated.
/home/ron_000/projects/hello3/theos/makefiles/instance/rules.mk:96: recipe for t
arget 'obj/main.m.ce2c1a2b.o' failed
make[2]: *** [obj/main.m.ce2c1a2b.o] Error 1
/home/ron_000/projects/hello3/theos/makefiles/instance/application.mk:39: recipe
for target 'internal-application-all_' failed
make[1]: *** [internal-application-all_] Error 2
/home/ron_000/projects/hello3/theos/makefiles/master/rules.mk:54: recipe for tar
get 'hello3.all.application.variables' failed
make: *** [hello3.all.application.variables] Error 2

有人知道我做错了什么吗?

感谢任何输入,

p.s我希望我以正确的方式使用代码块来解决这个问题......

最佳答案

难道你是用ARC(automatic reference counting)编译的?在这种情况下,docs说:
如果使用自动引用计数 (ARC),则不能直接使用自动释放池。相反,您使用 @autoreleasepool block 。例如,代替:

NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
// Code benefitting from a local autorelease pool.
[pool release];

你会写:

@autoreleasepool {
// Code benefitting from a local autorelease pool.
}

可以为单个文件禁用 ARC,请参阅 here .

关于ios - 未声明的 NSAutorelease,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23873265/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com