No.
Однако, вы можете swizzle-[NSURLRequest initWithURL:cachePolicy:timeoutInterval:]
предотвратить запрос выдается с самого начала, например:
static id (*oldMethod)(id self, SEL _cmd, NSURL* theURL, ....);
static id newMethod(id self, SEL _cmd, NSURL* theURL, ....) {
if ([[theURL absoluteString] hasPrefix:@"http://example.com"]) {
[self release];
return nil;
}
return oldMethod(self, _cmd, theURL, cachePolicy, timeoutInterval);
}
....
Method m = class_getInstanceMethod([NSURLRequest class],
@selector(initWithURL:cachePolicy:timeoutInterval:));
oldMethod = method_setImplementation(m, newMethod);
Обратите внимание, что возвращение nil
в целом небезопасен. Возможно, что запрос будет сохранен в некоторой структуре данных, и программа выйдет из строя.