0

I'm using the XMLRPC library that is set up to handle ARC and non-ARC projects. When i try to pass it a NSError object, i'm getting the error:

Implicit conversion of an Objective-C point to 'NSError *_autoreleasing *' is disallowed with ARC

and a warning:

Incompatible point types sending 'NSError *_strong' to parameter of type 'NSError *_autoreleasing *'

here is the method:

+ (XMLRPCResponse *)sendSynchronousXMLRPCRequest: (XMLRPCRequest *)request error: (NSError **)error {
    NSHTTPURLResponse *response = nil;
#if ! __has_feature(objc_arc)
    NSData *data = [[[NSURLConnection sendSynchronousRequest: [request request] returningResponse: &response error: error] retain] autorelease];
#else
    NSData *data = [NSURLConnection sendSynchronousRequest: [request request] returningResponse: &response error: error];
#endif

    if (response) {
        NSInteger statusCode = [response statusCode];

        if ((statusCode < 400) && data) {
#if ! __has_feature(objc_arc)
            return [[[XMLRPCResponse alloc] initWithData: data] autorelease];
#else
            return [[XMLRPCResponse alloc] initWithData: data];
#endif
        }
    }

    return nil;
}

Here is my attempt to call it:

NSError *myError;

XMLRPCResponse *serverResponse = [XMLRPCConnection sendSynchronousXMLRPCRequest:request error:myError];

I guess i am unfamiliar with the

#if

syntax, but i'm guessing it acts just like a regular If statement?

I also have ARC enabled:

enter image description here

Should i just redo the XMLRPCResponse method to remove handling of non-ARC projects or is there a reason i'm getting the error/warning?

Padin215
  • 7,444
  • 13
  • 65
  • 103

1 Answers1

1

Have a look at this answer here:

How do I know whether the compiler has ARC support enabled?

What compiler are you using? It might not support __has_feature

Regarding the error.. you should do something along the lines of:

NSError *error = nil;
XMLRPCResponse *serverResponse = [XMLRPCConnection sendSynchronousXMLRPCRequest:request error:&error];

As the method takes a double pointer for the error argument.

Community
  • 1
  • 1
NikosM
  • 1,131
  • 7
  • 9