Fix login conflict

This commit is contained in:
Sunnyyoung 2017-04-03 02:41:46 +08:00
parent 494cbea029
commit ff6e3c2667
2 changed files with 9 additions and 4 deletions

Binary file not shown.

View File

@ -55,13 +55,18 @@ static void __attribute__((constructor)) tweak(void) {
- (void)tweak_applicationDidFinishLaunching:(NSNotification *)notification {
[self tweak_applicationDidFinishLaunching:notification];
NSBundle *bundle = [objc_getClass("NSBundle") mainBundle];
NSString *bundleIdentifier = [bundle bundleIdentifier];
NSArray *instances = [objc_getClass("NSRunningApplication") runningApplicationsWithBundleIdentifier:bundleIdentifier];
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wobjc-method-access"
if (instances.count == 1) {
id serviceCenter = [objc_getClass("MMServiceCenter") defaultCenter];
id accountService = [serviceCenter getService:objc_getClass("AccountService")];
if ([accountService canAutoAuth]) {
[accountService AutoAuth];
}
}
#pragma clang diagnostic pop
}