From c572b1b84c3ca5a1eeb7f0c12d98d12ed886def6 Mon Sep 17 00:00:00 2001 From: opa334 Date: Fri, 25 Nov 2022 19:24:58 +0100 Subject: [PATCH] add safety check --- Shared/TSUtil.m | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Shared/TSUtil.m b/Shared/TSUtil.m index 85c115a..96d6688 100644 --- a/Shared/TSUtil.m +++ b/Shared/TSUtil.m @@ -18,7 +18,12 @@ void chineseWifiFixup(void) { NSBundle *bundle = [NSBundle bundleWithPath:@"/System/Library/PrivateFrameworks/SettingsCellular.framework"]; [bundle load]; - [[NSClassFromString(@"PSAppDataUsagePolicyCache") sharedInstance] setUsagePoliciesForBundle:NSBundle.mainBundle.bundleIdentifier cellular:true wifi:true]; + + PSAppDataUsagePolicyCache* policyCache = [NSClassFromString(@"PSAppDataUsagePolicyCache") sharedInstance]; + if([policyCache respondsToSelector:@selector(setUsagePoliciesForBundle:cellular:wifi:)]) + { + [policyCache setUsagePoliciesForBundle:NSBundle.mainBundle.bundleIdentifier cellular:true wifi:true]; + } } void loadMCMFramework(void)