简体   繁体   English

将ARC代码转换为非ARC

[英]Convert ARC code to non-ARC

I'm struggling to get an existing ARC-enabled control to run under Xcode 4.2 (OSX Snow Leopard), in a non-ARC-enabled project, and I'm facing various issues : 我正在努力使现有的支持ARC的控件在不支持ARC的项目中在Xcode 4.2(OSX Snow Leopard)下运行,并且面临各种问题:

How should I fix the following issues ? 我应该如何解决以下问题?

  • Use of (strong) in properties 在属性中使用(strong)
  • Use of (nonatomic) in properties 在属性中使用(nonatomic)
  • Instance methods not found (not having being declared in the interface) 找不到实例方法(未在接口中声明)
  • Enable new-style Objective-C 启用新型Objective-C

Also, it seems to be complaining about NSScrollerKnobStyle not being defined. 另外,似乎在抱怨NSScrollerKnobStyle Is it a 10.8-to-10.6 SDK-specific issue? 它是特定于10.8到10.6 SDK的问题吗?


PS The control I'm using is ITSidebar PS我正在使用的控件是ITSidebar

You're going to have to change those strong properties to retain or copy , as appropriate. 您将不得不适当地更改那些strong属性以retaincopy There's nothing wrong with nonatomic in non-ARC code. 非ARC代码中的非nonatomic没有错。

You may have to add @synthesize directives for your properties to get the compiler to add accessor methods. 您可能必须为属性添加@synthesize指令,以使编译器添加访问器方法。 @synthesize is the default in the latest compiler. @synthesize是最新编译器中的默认值。

There ae a number of other changes to the language, such as object literals. 语言还有许多其他更改,例如对象文字。 They're all well documented; 他们都有据可查; you just need to apply them in reverse. 您只需要反向应用它们即可。

I'm not sure about NSScrollerKnobStyle , but if you look it up the documentation will tell you when it was introduced. 我不确定NSScrollerKnobStyle ,但是如果您查找它,文档将告诉您何时引入。

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

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