aboutsummaryrefslogtreecommitdiff
path: root/Foundation/GTMNSObject+KeyValueObserving.m
diff options
context:
space:
mode:
Diffstat (limited to 'Foundation/GTMNSObject+KeyValueObserving.m')
-rw-r--r--Foundation/GTMNSObject+KeyValueObserving.m10
1 files changed, 10 insertions, 0 deletions
diff --git a/Foundation/GTMNSObject+KeyValueObserving.m b/Foundation/GTMNSObject+KeyValueObserving.m
index dde77e5..9247082 100644
--- a/Foundation/GTMNSObject+KeyValueObserving.m
+++ b/Foundation/GTMNSObject+KeyValueObserving.m
@@ -411,12 +411,17 @@ static void SwizzleMethodsInClass(Class cls, SEL sel1, SEL sel2) {
method_exchangeImplementations(m1, m2);
}
+#if GTM_PERFORM_KVO_CHECKS
+
+// This is only used when GTM_PERFORM_KVO_CHECKS is on.
static void SwizzleClassMethodsInClass(Class cls, SEL sel1, SEL sel2) {
Method m1 = class_getClassMethod(cls, sel1);
Method m2 = class_getClassMethod(cls, sel2);
method_exchangeImplementations(m1, m2);
}
+#endif // GTM_PERFORM_KVO_CHECKS
+
// This category exists to attempt to help deal with tricky KVO issues.
// KVO is a wonderful technology in some ways, but is extremely fragile and
// allows developers a lot of freedom to shoot themselves in the foot.
@@ -474,6 +479,9 @@ GTM_METHOD_CHECK(NSArray,
_gtmDebugArrayAddObserver:toObjectsAtIndexes:forKeyPath:options:context:);
GTM_METHOD_CHECK(NSArray,
_gtmDebugArrayRemoveObserver:fromObjectsAtIndexes:forKeyPath:);
+
+#if GTM_PERFORM_KVO_CHECKS
+
GTM_METHOD_CHECK(NSObject,
_gtmCheckAddObserver:forKeyPath:options:context:);
GTM_METHOD_CHECK(NSArray,
@@ -481,6 +489,8 @@ GTM_METHOD_CHECK(NSArray,
GTM_METHOD_CHECK(NSObject,
_gtmAccessInstanceVariablesDirectly);
+#endif // GTM_PERFORM_KVO_CHECKS
+
+ (void)load {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSDictionary *env = [[NSProcessInfo processInfo] environment];