将iOS应用移植到Mac

编程入门 行业动态 更新时间:2024-10-26 13:32:07
本文介绍了将iOS应用移植到Mac-如何处理内存管理?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我的代码中当然包含所有的保留/释放调用. . .是否在不使用垃圾回收的情况下编写Mac应用程序(然后对保留/释放进行处理)会更容易?

My code has all the retain/release calls in it of course . . . is it likely to be easier to write the mac app with garbage collection (and then what do I do about the retains/releases) or without?

无论采用哪种推荐方式,有关相关Xcode设置的任何指针都将有所帮助.谢谢.

Whichever way you recommend, any pointers about relevant Xcode settings would be helpful. Thanks.

推荐答案

出于各种原因,我强烈建议您不要在Mac上使用GC,请坚持使用您以前已经做过的事情.我相信,当您依靠GC管理内存时,您会放弃很多细粒度的控制,而我个人并不喜欢这样做.

I highly recommend that you not use GC on Mac for various reasons, just stick to what you're used to doing already. I believe that when you rely on GC to manage memory, you give up a lot of fine-grain control, which I personally don't enjoy doing.

由于您已经来自像iOS这样的具有引用计数的环境,因此我认为,留在该环境中是明智之举,因为此时您无需付出更多努力.

Since you're already coming from a reference-counted environment like iOS, I think that it would be wise of you to stay in that environment, given that it's not going to take much more effort on your part at this point.

您将需要将视图控制器和基于视图的代码移植到Cocoa,但这不应该太麻烦.您可以放入模型,因为它们没有任何视图依赖性. (当然,前提是您做到了一点点理智).

You will need to port your view controllers and view-based code to Cocoa, but that shouldn't be too much of a hassle. You can drop in your models, because they don't have any view dependencies. (of course assuming you did it with an ounce of sanity).

更多推荐

将iOS应用移植到Mac

本文发布于:2023-10-07 15:42:30,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1469806.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:iOS   Mac

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!