FPRProxyObjectHelper.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334
  1. // Copyright 2020 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #import <Foundation/Foundation.h>
  15. /** This class helps the instrumentation deal with objects that have been wrapped with NSProxy
  16. * objects after being swizzled by other SDKs. In particular, Crittercism swizzles NSURLSessions
  17. * and makes every NSURLSession initialization method return an NSProxy subclass.
  18. */
  19. @interface FPRProxyObjectHelper : NSObject
  20. /** Registers a proxy object for a given class and runs the onSuccess block whenever an ivar of the
  21. * given class is discovered on the proxy object.
  22. *
  23. * @param proxy The proxy object whose ivars will be iterated.
  24. * @param superclass The superclass all ivars will be compared against. See varFoundHandler.
  25. * @param varFoundHandler The block to run when an ivar isKindOfClass:aClass.
  26. */
  27. + (void)registerProxyObject:(id)proxy
  28. forSuperclass:(Class)superclass
  29. varFoundHandler:(void (^)(id ivar))varFoundHandler;
  30. @end