objective c - Calling an instance method when subclassing NSURLProtocol -
so i've had subclass nsurlprotocol because using uiwebview , want intercept ajax calls works fine per this example. have data request + (bool)caninitwithrequest:(nsurlrequest *)request
causes problem, need call instance methods things data, can't because it's class method.
how call instance method based on contents of in request?
you cannot call instance methods class method without having instance first. true object-oriented systems, afaik. after all, instance methods (usually) use data class method cannot have. imagine object property name
, , have 1 thousand objects different names. how should class method know name
use?
so need find way somehow query instances of class based on request, or find way @ information in way not involve instance variables (if method doesn't use instance variable can turn class method or c function). there many different ways solve "query problem", chose highly dependent on design , taste.
Comments
Post a Comment