IOS5 ARC Errors: SKPSMTPMessage

I am trying to incorporate this bit of code into a new (iOS 5) project ... The problem is that I use ARC and it REALLY does not like the code written.

I was able to solve most of the errors, but I was stuck in three errors that, it seems to me, they cannot understand.

Error # 1:

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

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

Errors # 2 and # 3:

Passing the address of a non-local object to the _autoreleasing parameter for writeback

.h

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

    id <SKPSMTPMessageDelegate> delegate;
}

.m

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

Any guidance is appreciated.

Thank.

+5
source share
2 answers

I found the right solution for this question.

Answer: Do not try to convert the code yourself.

-fno-objc-arc

enter image description here

+6

# 1

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

To

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

assign ARC

# 2,3
alloc init outputStream inputStream.

NSInputStream *inputStream;
NSOutputStream *outputStream;
[NSStream getStreamsToHostNamed:relayHost port:relayPort inputStream:&inputStream outputStream:&outputStream];
0

All Articles