Production iOS app freezes
Hello and thanks for the great project!
We are 72 hours into trying to understand what could cause the Isolate to freeze when our app is compiled and distributed with TestFlight. Everything works correctly in debug, profiling and distribution, but when we try flutter build ipa with our without the --obfuscate option, going into the Isolate does not return.
Initially I thought too many plugins where loaded inside the Isolate (MLKIt, TensorFlow and OpenCV), but even trying each of them individually, the result is the same.
Switching to a "non Isolated" execution of the same method works, but the UI is rightfully janky.
Flutter (Channel stable, 3.0.4, on macOS 11.6.5 20G527 darwin-x64, locale en-US)
• Flutter version 3.0.4 at /usr/local/Caskroom/flutter/2.2.3/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 85684f9300 (8 days ago), 2022-06-30 13:22:47 -0700
• Engine revision 6ba2af10bb
• Dart version 2.17.5
• DevTools version 2.12.2
Xcode - develop for iOS and macOS (Xcode 13.2.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.11.2
I don't think there is any issue with the code, but certainly something is missing/wrong in the build stage.
I am here to see if anyone else ran into the same issue!
The question is whether this is true of isolates in general or anything specific to isolate_handler. I don't think the second is very probable because it doesn't do anything special on its own in the first place. Did you possibly try with a plain Dart Isolate, then with a FlutterIsolate, too?
HI
No solution for us yet, we are running the process in the main thread 😓
I can't tell if this is true for plain Isolates too, everything we do is related to plug-ins, and our only viable tool is isolate_handler 👍🏼
Well, I'm not proficient with Xcode at all (I can use it to ocasionally build my apps for iOS but otherwise, I don't use anything Apple), but on one hand, I suspect that you could try to debug it somehow, but, on the other hand, I also suspect that you're already doing this. :-)
By adding lots of log output lines, do you have at least an idea which part of your code doesn't return?
Yeah, I went down the rabbit hole for a while. Logging from inside Isolates would only work in development, so we accepted that this is probably a corner case we can't solve, at least for now!
Thank you
Consider trying out this PR with a dependency override. https://github.com/rmawatson/flutter_isolate/pull/118
It handles obfuscation etc. But be sure to add pragmas to your top level functions when using obfuscation.