简体   繁体   English

用于iPhone的用户定义的运行时属性无法正常工作

[英]User Defined Runtime Attributes in IB for iPhone not working

I have a weird problem. 我有一个奇怪的问题。

I am trying to setup User Defined Runtime Attribute in the IB. 我正在尝试在IB中设置用户定义的运行时属性。 As shown below I setup a NSString statID attribute in my viewController and wanted to give it a test value 00000 in IB 如下所示,我在viewController中设置了NSString statID属性,并希望在IB中为其提供测试值00000

用户定义的运行时属性

When I compile that I get this error when building: "User defined runtime attributes on Mac OS X versions prior to 10.6" 当我编译时,我在构建时遇到此错误:“在10.6之前的Mac OS X版本上用户定义的运行时属性”

I know I can set up user defined attributes in iOS from the iOS docs found here go down to section: "Configuring Runtime Attributes for Custom Objects" 我知道我可以在iOS中从这里找到的iOS文档设置用户定义的属性到下面的部分:“为自定义对象配置运行时属性”

Any idea why it is giving me the error? 知道为什么它会给我错误吗?

User defined runtime attributes are available now in XCode 4.2. 用户定义的运行时属性现在可在XCode 4.2中使用。 However it requires: 但它需要:

  • Compiling with iOS 5.0. 使用iOS 5.0进行编译。
  • Setting the .xib version attribute to 4.2 将.xib版本属性设置为4.2
  • Running in a simulator or device with iOS 5.0. 使用iOS 5.0在模拟器或设备中运行。 Older version won't work. 旧版本无法使用。

OK, I got an answer. 好的,我得到了答案。

So here it goes. 所以这就是它。

I am using the beta version of XCode 4. As it is a beta versions it has errors, one of them is displaying "User Defined Runtime Attributes" window in an IB. 我正在使用XCode 4的测试版。由于它是测试版,它有错误,其中一个是在IB中显示“用户定义的运行时属性”窗口。 The error "User defined runtime attributes on Mac OS X versions prior to 10.6" informs you that "User Defined Runtime Attributes" option is only availabe for OS X apps and not for iOS. 错误“用户在10.6之前的Mac OS X版本上定义的运行时属性”通知您“用户定义的运行时属性”选项 适用于OS X应用程序而不适用于iOS。

It dissapoints me but at least I don't have to wonder why is it not working. 它让我失望,但至少我不知道为什么它不起作用。

i'm going to answer this anew, because i think @AntonioVieiro's comment is so helpful, and because it can be made to work. 我将重新回答这个问题,因为我认为@AntonioVieiro的评论是如此有用,因为它可以成功。

the error i was seeing was: "Size type user defined runtime attributes with Xcode versions prior to 4.3". 我看到的错误是:“大小类型用户定义的运行时属性与Xcode版本4.3之前”。 i had ignored it for a while, because things ran despite the diagnostic. 我暂时忽略了它,因为尽管有诊断,事情仍在继续。 but it always bugged me that i am running Xcode 4.3.2 and would be getting this error. 但它总是告诉我,我正在运行Xcode 4.3.2并且会收到此错误。

the link ignore attribute unavailable warning in Xcode4 points to the solution that gets rid of the errors: it's step by step, and very useful. Xcode4中的链接忽略属性不可用警告指向摆脱错误的解决方案:它是一步一步的,非常有用。 and it does allow the use of user defined runtime attributes now in iOS . 它确实允许在iOS中使用用户定义的运行时属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM