构建 32 位 OS X 应用程序时出错? [英] Error building 32-bit OS X app?

查看:31
本文介绍了构建 32 位 OS X 应用程序时出错?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发我的第一个 Mac OS X 应用程序.我的项目是使用 XCode 默认设置的,我没有触及任何构建设置.为 Mac 64 位构建时,该应用程序运行良好.但是,在为 Mac 32 位构建时,我收到一个看似随意的错误:

I'm working on my first Mac OS X app. My project was set-up with XCode defaults and I haven't touched any Build Settings. When building for Mac 64-bit, the app runs fine. However, when building for Mac 32-bit, I get a seemingly arbitrary error that says:

语义问题:合成属性myProperty"必须与兼容的 ivar 命名相同,或者必须明确命名为 ivar.

我可以检查哪些项目?

推荐答案

听起来你已经发现了错误,但我想我可以回答你的问题,以防其他人以后发现它.

It sounds like you have found the error but I think I can answer your question just in case someone else later finds it.

Apple 在 64 位 Objective-C 运行时中进行了很多他们以前无法做到的更改,因为它会破坏二进制兼容性.不同之处之一是在 32 位运行时合成属性必须由实例变量支持.在 64 位运行时合成属性 sill 需要这些,但它们是自动为您创建的.默认情况下,实例变量的名称应与属性名称相同.

Apple has made a lot of changes in the 64 bit Objective-C runtime which they couldn't do before since it would break binary compatibility. One of the things that is different is that in the 32 bit runtime synthesized properties have to be backed by instance variables. On the 64-bit runtime synthesized properties sill needs that but they are created automatically for you. By default the name of the instance variable should be the same as the name of the property.

因此,如果您需要支持 32 位,请确保为所有属性创建实例变量.如果您只支持 64 位,那么您仍然可以这样做,以便您的代码可以同时为 32 位和 64 位构建,但您不必这样做.

So in case you need to support 32 bit then make sure that you create instance variables for all your properties. If you only support 64 bit then you can still do that so that your code can be built for both 32 bit and 64 bit at the same time but you don't have to.

这篇关于构建 32 位 OS X 应用程序时出错?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆