iOS5 ARC 错误 : SKPSMTPMessage

标签 ios5 automatic-ref-counting

我正在尝试合并此 bit of code进入一个新的(iOS 5)项目......问题是,我正在使用 ARC,它真的不喜欢所写的代码。

我已经能够解决大多数错误,但是我遇到了 3 个我似乎无法弄清楚的错误。

错误 #1:

Existing ivar 'delegate' for unsafe_unretained property 'delegate' must be _unsafe_unretained



。H
@interface SKPSMTPMessage : NSObject {  
    NSOutputStream *outputStream;
    NSInputStream *inputStream;

    id <SKPSMTPMessageDelegate> delegate;
}

@property(nonatomic, assign) id <SKPSMTPMessageDelegate> delegate;

.m
@synthesize login, pass, relayHost, relayPorts, subject, fromEmail, toEmail, parts, requiresAuth, inputString, wantsSecure, \
delegate, connectTimer, connectTimeout, watchdogTimer, validateSSLChain;

错误 #2 和 #3:

Passing address of non-local object to _autoreleasing parameter for write-back



。H
@interface SKPSMTPMessage : NSObject {  
    NSOutputStream *outputStream;
    NSInputStream *inputStream;

    id <SKPSMTPMessageDelegate> delegate;
}

.m
[NSStream getStreamsToHostNamed:relayHost port:relayPort inputStream:&inputStream outputStream:&outputStream];

任何指导将不胜感激。

谢谢。

最佳答案

我为这个问题找到了正确的解决方案。

答案是:不要打扰自己手动转换代码。

您只需要添加编译器标志 -fno-objc-arc导入类

enter image description here

关于iOS5 ARC 错误 : SKPSMTPMessage,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9551048/

相关文章:

ios - 开始编辑时清除 UITextView 上的文本

iphone - UITabViewController、viewWillAppear 没有被调用?

iphone - 具有先前 View 的主/详细项目

cocoa-touch - 使用 API 在 iOS5 上自定义 TabBar

iphone - XCode 中的简单 Torch 应用

swift - 为什么 self 不会在 block 中自动声明为无主?

objective-c - 什么会导致我(强)声明的属性(property)在我背后变成零?

objective-c - 循环和便利方法是否会导致 ARC 出现内存峰值?

objective-c - ARC 不允许将间接指针转换为指向 'CFReadStreamRef *' 的 Objective-C 指针

iphone - Objective-C 和 ARC : Why value stored to during its initialization is never read?