Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Freezing occurs when running iOS app in MacBook (M1 process) #179

Open
lcg5450 opened this issue Apr 20, 2021 · 1 comment
Open

Freezing occurs when running iOS app in MacBook (M1 process) #179

lcg5450 opened this issue Apr 20, 2021 · 1 comment

Comments

@lcg5450
Copy link

lcg5450 commented Apr 20, 2021

I was experiencing freezing when running the iOS app on the MacBook (M1 process).
So, looking for the cause, there was a problem with swizzling.

https://github.com/ReactorKit/ReactorKit/blob/master/Sources/ReactorKitRuntime/ReactorKitRuntime.m

#if !TARGET_OS_MACCATALYST
    [self swizzleInitializeOfClassNamed:@"NSViewController"];
#endif

It seems that only the iPad app is supported, but it seems that the iOS app must be handled together for normal operation.

https://stackoverflow.com/questions/65042788/how-to-detect-if-an-ios-app-is-running-on-an-m1-mac

So I'm checking the isiOSAppOnMac flag in the private repo and handling it, and I'm curious if there are any other ideas.
(I am not good at English. Even if the words are awkward, I hope you understand.)

@iTofu
Copy link

iTofu commented Jan 18, 2022

You are right, but they don't seem to be dealing with it……
And I modify this func by your words, it works fine now, so thank you @lcg5450:

+ (void)load {
  static dispatch_once_t onceToken;
  dispatch_once(&onceToken, ^{
    [self swizzleViewDidLoadOfClassNamed:@"UIViewController"];

    #if !TARGET_OS_MACCATALYST
    bool isiOSAppOnMac = NO;
    if (@available(iOS 14.0, *)) {
      isiOSAppOnMac = [[NSProcessInfo processInfo] isiOSAppOnMac];
    }
    if (!isiOSAppOnMac) {
      [self swizzleViewDidLoadOfClassNamed:@"NSViewController"];
    }
    #endif
  });
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants