Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AFNetworking 2.0 iOS 7 Copy with zone warning in AFHTTPRequestOperation.h file

In AFNetworking 2.x version for Xcode 5, I am Continuously Receiving the warning for this Method for this

AFHTTPRequestOperation *operation = [[[self class] allocWithZone:zone] initWithRequest:self.request];

the self.request is Incompatible pointer types sending 'NSURLRequest *' to parameter of type 'MKLocalSearchRequest *'

#pragma mark - NSCopying

- (id)copyWithZone:(NSZone *)zone {
    AFHTTPRequestOperation *operation = [[[self class] allocWithZone:zone] initWithRequest:self.request];

    operation.responseSerializer = [self.responseSerializer copyWithZone:zone];
    operation.completionQueue = self.completionQueue;
    operation.completionGroup = self.completionGroup;

    return operation;
}

is anybody get Solved this issue(warning) ..

like image 310
hardikdevios Avatar asked Dec 29 '25 20:12

hardikdevios


1 Answers

The problem is that [self class] returns a Class object of a type that is not determined. The compiler is matching the -initWithRequest: method with that from MapKit. This can be fixed by changing the code to:

AFHTTPRequestOperation *operation = [(AFHTTPRequestOperation *)[[self class] allocWithZone:zone] initWithRequest:self.request];
like image 121
Holly Avatar answered Dec 31 '25 11:12

Holly