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

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

问题描述

我正在使用我的第一个Mac OS X应用程式。我的项目设置了XCode默认值,我没有接触任何构建设置。当构建为Mac 64位,应用程序运行良好。但是,当构建为Mac 32位,我得到一个看似任意的错误,说:



语义问题:合成属性myProperty必须



我可以检查什么样的东西?

解决方案

听起来你发现错误,但我想我可以回答你的问题,以防万一后来发现它。

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



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


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:

Semantic issue: Synthesized property 'myProperty' must either be named the same as a compatible ivar or must explicitly name an ivar.

What kind of things can I check for?

解决方案

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 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.

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天全站免登陆