Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS5 ARC errors: SKPSMTPMessage

I'm attempting to incorporate this bit of code into a new(iOS 5) project... Problem is, I'm using ARC and it REALLY doesn't like the code as written.

I've been able to resolve most of the errors, but I'm stuck with 3 errors I can't seem to figure out.

Error #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;

Errors #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];

Any guidance will be greatly appreciated.

Thanks.

like image 698
dbarrett Avatar asked Mar 04 '12 00:03

dbarrett


1 Answers

I have found right solution for this question.

The answer is: Dont bother yourself converting code manually.

You just need to add compiler flag -fno-objc-arc to imported classes

enter image description here

like image 88
Igor Konoplyanko Avatar answered Sep 21 '22 06:09

Igor Konoplyanko