简体   繁体   中英

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. As shown below I setup a NSString statID attribute in my viewController and wanted to give it a test value 00000 in IB

用户定义的运行时属性

When I compile that I get this error when building: "User defined runtime attributes on Mac OS X versions prior to 10.6"

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"

Any idea why it is giving me the error?

User defined runtime attributes are available now in XCode 4.2. However it requires:

  • Compiling with iOS 5.0.
  • Setting the .xib version attribute to 4.2
  • Running in a simulator or device with 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. 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.

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.

the error i was seeing was: "Size type user defined runtime attributes with Xcode versions prior to 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.

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. and it does allow the use of user defined runtime attributes now in iOS .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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