不需要以前的 AFNetworking 知识,但它可能会有所帮助。
我正在使用 AFNetworking,我想创建一个 AFHTTPRequestOperation 的子类,它有几个额外的属性和方法。
我遇到的问题是我正在使用 AFHTTPRequestOperationManager 的工厂方法来生成我的 AFHTTPRequestOperations 并且我显然不想更改 AFNetworking 库中的任何核心代码。
所以我想做的是这样的:
@implementation VP_AFHTTPRequestOperation : AFHTTPRequestOperation
+ (id)instantiateUsingAFHTTPRequestOperation:(AFHTTPRequestOperation*)reqOp {
//I want to create an instance of VP_AFHTTPRequestOperation using the reqOp
self = reqOp; //I can't just do this, but I don't know what to do
return self;
}
- (void)mySubclassMethod { /* ... */ }
@end
我会很感激任何建议