diff --git a/SJBackGRProject/.DS_Store b/SJBackGRProject/.DS_Store index 061ce00..0851d4c 100644 Binary files a/SJBackGRProject/.DS_Store and b/SJBackGRProject/.DS_Store differ diff --git a/SJBackGRProject/SJBackGRProject.xcworkspace/xcuserdata/bluedancer.xcuserdatad/UserInterfaceState.xcuserstate b/SJBackGRProject/SJBackGRProject.xcworkspace/xcuserdata/bluedancer.xcuserdatad/UserInterfaceState.xcuserstate index efbee80..94ba35b 100644 Binary files a/SJBackGRProject/SJBackGRProject.xcworkspace/xcuserdata/bluedancer.xcuserdatad/UserInterfaceState.xcuserstate and b/SJBackGRProject/SJBackGRProject.xcworkspace/xcuserdata/bluedancer.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/SJFullscreenPopGesture.podspec b/SJFullscreenPopGesture.podspec index 4e1eb46..731b7dc 100644 --- a/SJFullscreenPopGesture.podspec +++ b/SJFullscreenPopGesture.podspec @@ -9,7 +9,7 @@ Pod::Spec.new do |s| s.name = "SJFullscreenPopGesture" - s.version = "1.4.1" + s.version = "1.4.2" s.summary = "fullscreen pop gestures." s.description = 'fullscreen pop gesture. System native gestures and custom gestures are free to switch.' diff --git a/SJFullscreenPopGesture/UINavigationController+SJVideoPlayerAdd.m b/SJFullscreenPopGesture/UINavigationController+SJVideoPlayerAdd.m index c49940b..41eaac0 100644 --- a/SJFullscreenPopGesture/UINavigationController+SJVideoPlayerAdd.m +++ b/SJFullscreenPopGesture/UINavigationController+SJVideoPlayerAdd.m @@ -46,7 +46,13 @@ + (void)load { SEL swizzledSelector = sel[++ i]; Method originalMethod = class_getInstanceMethod(nav, originalSelector); Method swizzledMethod = class_getInstanceMethod(nav, swizzledSelector); - method_exchangeImplementations(originalMethod, swizzledMethod); + BOOL added = class_addMethod([self class], originalSelector, method_getImplementation(swizzledMethod), method_getTypeEncoding(swizzledMethod)); + if ( added ) { + class_replaceMethod([self class], swizzledSelector, method_getImplementation(originalMethod), method_getTypeEncoding(originalMethod)); + } + else { + method_exchangeImplementations(originalMethod, swizzledMethod); + } } }); } diff --git a/SJNavigationPopGesture.podspec b/SJNavigationPopGesture.podspec index 68671a0..e192462 100644 --- a/SJNavigationPopGesture.podspec +++ b/SJNavigationPopGesture.podspec @@ -16,7 +16,7 @@ Pod::Spec.new do |s| # s.name = "SJNavigationPopGesture" - s.version = "1.4.1" + s.version = "1.4.2" s.summary = "fullscreen pop gestures." # This description is used to generate tags and improve search results. diff --git a/SJNavigationPopGesture/SJNavigationPopGesture.swift b/SJNavigationPopGesture/SJNavigationPopGesture.swift index fe0065a..113071e 100644 --- a/SJNavigationPopGesture/SJNavigationPopGesture.swift +++ b/SJNavigationPopGesture/SJNavigationPopGesture.swift @@ -67,9 +67,15 @@ public class SJNavigationPopGesture { for sel in selArr { let originalSelector = sel[0] let swizzledSelector = sel[1] - let originalMethod = class_getInstanceMethod(cls, originalSelector); - let swizzledMethod = class_getInstanceMethod(cls, swizzledSelector); - method_exchangeImplementations(originalMethod!, swizzledMethod!) + let originalMethod = class_getInstanceMethod(cls, originalSelector)!; + let swizzledMethod = class_getInstanceMethod(cls, swizzledSelector)!; + let added = class_addMethod(cls, originalSelector, method_getImplementation(swizzledMethod), method_getTypeEncoding(swizzledMethod)) + if ( added ) { + class_replaceMethod(cls, swizzledSelector, method_getImplementation(originalMethod), method_getTypeEncoding(originalMethod)); + } + else { + method_exchangeImplementations(originalMethod, swizzledMethod) + } } } }