GNUStep NSAutoreleasePool 不兼容
根据另一篇 Stack Overflow 帖子,drain
message 是 Apple 独有的调用:
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSLog (@"Hello");
[pool drain];
return 0;
将 drain
替换为 release
是否安全?我正在尝试移植一个 Objective-C 应用程序以在 Linux(目前是 Ubuntu)上运行。我应该在开始之前就放弃吗? (我在尝试让 NSURLConnection
工作时已经遇到问题)
According to another Stack Overflow post the drain
message is an Apple-only call:
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSLog (@"Hello");
[pool drain];
return 0;
Is it safe to replace drain
with release
? I am trying to port an Objective-C application to run on Linux (Ubuntu at the moment). Should I give up even before I have started? (I'm already having issues trying to get NSURLConnection
working)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
来自 Apple 的
drain
文档:因此,耗尽自动释放池意味着不可避免地要重新分配它。在我看来,Apple 应该弃用
drain
,因为它只会造成混乱。但:
From Apple's documentation of
drain
:So draining an autorelease pool means deallocating it inevitably. In my opinion, Apple should deprecate
drain
since it only creates confusion.But: