Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

iOS Support #3

Merged
merged 1 commit into from

2 participants

Anton Serebryakov Jonathan 'Wolf' Rentzsch
Anton Serebryakov

No description provided.

Jonathan 'Wolf' Rentzsch rentzsch merged commit 57f9d1b into from
Jonathan 'Wolf' Rentzsch
Owner

Looks great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 4, 2011
  1. Anton Serebryakov

    Added iOS support

    serebryakov-av authored
This page is out of date. Refresh to see the latest.
Showing with 15 additions and 1 deletion.
  1. +15 −1 JRSwizzle.m
16 JRSwizzle.m
View
@@ -2,7 +2,13 @@
// Some rights reserved: http://opensource.org/licenses/mit-license.php
#import "JRSwizzle.h"
-#import <objc/objc-class.h>
+
+#if TARGET_OS_IPHONE
+ #import <objc/runtime.h>
+ #import <objc/message.h>
+#else
+ #import <objc/objc-class.h>
+#endif
#define SetNSErrorFor(FUNC, ERROR_VAR, FORMAT,...) \
if (ERROR_VAR) { \
@@ -25,13 +31,21 @@ + (BOOL)jr_swizzleMethod:(SEL)origSel_ withMethod:(SEL)altSel_ error:(NSError**)
#if OBJC_API_VERSION >= 2
Method origMethod = class_getInstanceMethod(self, origSel_);
if (!origMethod) {
+#if TARGET_OS_IPHONE
+ SetNSError(error_, @"original method %@ not found for class %@", NSStringFromSelector(origSel_), [self class]);
+#else
SetNSError(error_, @"original method %@ not found for class %@", NSStringFromSelector(origSel_), [self className]);
+#endif
return NO;
}
Method altMethod = class_getInstanceMethod(self, altSel_);
if (!altMethod) {
+#if TARGET_OS_IPHONE
+ SetNSError(error_, @"alternate method %@ not found for class %@", NSStringFromSelector(altSel_), [self class]);
+#else
SetNSError(error_, @"alternate method %@ not found for class %@", NSStringFromSelector(altSel_), [self className]);
+#endif
return NO;
}
Something went wrong with that request. Please try again.