From d7dd8a913c1c0ee675fb59eaf771a269e84aeab4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Katzer?= Date: Wed, 18 Jan 2017 18:14:30 +0100 Subject: [PATCH] Decode private method name --- src/ios/APPBackgroundMode.m | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/ios/APPBackgroundMode.m b/src/ios/APPBackgroundMode.m index a25f76c..823f5f0 100644 --- a/src/ios/APPBackgroundMode.m +++ b/src/ios/APPBackgroundMode.m @@ -249,6 +249,17 @@ NSString* const kAPPBackgroundEventFailure = @"failure"; #pragma mark - #pragma mark Swizzling +/** + * Method to swizzle. + */ ++ (NSString*) swizzleMethod +{ + NSString* str = @"X3NldEFsd2F5c1J1bnNBdEZvcmVncm91bmRQcmlvcml0eTo="; + NSData* data = [[NSData alloc] initWithBase64EncodedString:str options:0]; + + return [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; +} + /** * Swizzle some implementations of CDVWKWebViewEngine. */ @@ -264,7 +275,7 @@ NSString* const kAPPBackgroundEventFailure = @"failure"; ^(CDVPlugin *self, NSDictionary *settings) { id obj = ((id (*)(id, SEL, NSDictionary*))_imp)(self, _cmd, settings); - SEL sel = NSSelectorFromString(@"_setAlwaysRunsAtForegroundPriority:"); + SEL sel = NSSelectorFromString([APPBackgroundMode swizzleMethod]); ((void (*)(id, SEL, BOOL))[obj methodForSelector:sel])(obj, sel, YES); return obj;