gpt4 book ai didi

ios - AFNetworking 2.0 iOS 7 在 AFHTTPRequestOperation.h 文件中复制带有区域警告

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:01:38 25 4
gpt4 key购买 nike

在 Xcode 5 的 AFNetworking 2.x 版本中,我不断收到此方法的警告

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

self.request是不兼容的指针类型发送 'NSURLRequest *''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;
}

有人解决了这个问题吗(警告)..

最佳答案

问题是 [self class] 返回一个未确定类型的 Class 对象。编译器正在将 -initWithRequest: 方法与 MapKit 中的方法相匹配。这可以通过将代码更改为:

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

关于ios - AFNetworking 2.0 iOS 7 在 AFHTTPRequestOperation.h 文件中复制带有区域警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21669558/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com