From ca3530d2323e0a55b8873f0b3b0a38b32f4e29d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Katzer?= Date: Thu, 19 Jan 2017 10:09:17 +0100 Subject: [PATCH] Prefer setProperty over the private setter --- src/ios/APPBackgroundMode.m | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ios/APPBackgroundMode.m b/src/ios/APPBackgroundMode.m index 823f5f0..86e80dc 100644 --- a/src/ios/APPBackgroundMode.m +++ b/src/ios/APPBackgroundMode.m @@ -252,9 +252,9 @@ NSString* const kAPPBackgroundEventFailure = @"failure"; /** * Method to swizzle. */ -+ (NSString*) swizzleMethod ++ (NSString*) wkProperty { - NSString* str = @"X3NldEFsd2F5c1J1bnNBdEZvcmVncm91bmRQcmlvcml0eTo="; + NSString* str = @"X2Fsd2F5c1J1bnNBdEZvcmVncm91bmRQcmlvcml0eQ=="; NSData* data = [[NSData alloc] initWithBase64EncodedString:str options:0]; return [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; @@ -275,8 +275,8 @@ NSString* const kAPPBackgroundEventFailure = @"failure"; ^(CDVPlugin *self, NSDictionary *settings) { id obj = ((id (*)(id, SEL, NSDictionary*))_imp)(self, _cmd, settings); - SEL sel = NSSelectorFromString([APPBackgroundMode swizzleMethod]); - ((void (*)(id, SEL, BOOL))[obj methodForSelector:sel])(obj, sel, YES); + [obj setValue:[NSNumber numberWithBool:YES] + forKey:[APPBackgroundMode wkProperty]]; return obj; }