diff --git a/.travis.yml b/.travis.yml index f827d1b..7d3a63b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,4 @@ language: objective-c script: -- xcodebuild -project AspectsDemo/AspectsDemo.xcodeproj -scheme AspectsDemo -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO test -- xcodebuild -project AspectsDemo/AspectsDemo.xcodeproj -scheme AspectsDemo -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPad Retina (64-bit),OS=8.1' test +- xcodebuild -project AspectsDemo/AspectsDemo.xcodeproj -scheme AspectsDemo -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone X,OS=11.3' test - xcodebuild -project AspectsDemoOSX/AspectsDemoOSX.xcodeproj -scheme AspectsDemoOSX test diff --git a/Aspects.m b/Aspects.m index c907066..86d6285 100644 --- a/Aspects.m +++ b/Aspects.m @@ -401,9 +401,9 @@ static void aspect_swizzleForwardInvocation(Class klass) { static void aspect_undoSwizzleForwardInvocation(Class klass) { NSCParameterAssert(klass); Method originalMethod = class_getInstanceMethod(klass, NSSelectorFromString(AspectsForwardInvocationSelectorName)); - Method objectMethod = class_getInstanceMethod(NSObject.class, @selector(forwardInvocation:)); - // There is no class_removeMethod, so the best we can do is to retore the original implementation, or use a dummy. - IMP originalImplementation = method_getImplementation(originalMethod ?: objectMethod); + Method superClassMethod = class_getInstanceMethod(class_getSuperclass(klass) ?: NSObject.class, @selector(forwardInvocation:)); + // There is no class_removeMethod, so the best we can do is to retore the original implementation, or use superclass's. + IMP originalImplementation = method_getImplementation(originalMethod ?: superClassMethod); class_replaceMethod(klass, @selector(forwardInvocation:), originalImplementation, "v@:@"); AspectLog(@"Aspects: %@ has been restored.", NSStringFromClass(klass)); diff --git a/AspectsDemo/AspectsDemo.xcodeproj/project.pbxproj b/AspectsDemo/AspectsDemo.xcodeproj/project.pbxproj index ecec2b8..5879385 100644 --- a/AspectsDemo/AspectsDemo.xcodeproj/project.pbxproj +++ b/AspectsDemo/AspectsDemo.xcodeproj/project.pbxproj @@ -331,7 +331,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -381,7 +381,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; @@ -413,6 +413,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "AspectsDemo/AspectsDemo-Prefix.pch"; INFOPLIST_FILE = "AspectsDemo/AspectsDemo-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = app; }; @@ -426,6 +427,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "AspectsDemo/AspectsDemo-Prefix.pch"; INFOPLIST_FILE = "AspectsDemo/AspectsDemo-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = app; };