@DTS Engineer
Ok, I followed your steps and discovered something interesting 🤓
Since my project is quite large, I initially decided to move and run the test code directly in the AppDelegate’s application(_:didFinishLaunchingWithOptions:) method. And it works! Even the UIApplication.shared.setAlternateIconName() method works as well.
final class AppDelegate: UIResponder, UIApplicationDelegate {
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
Task {
_ = try! await URLSession.shared.allTasks
try! await UIApplication.shared.setAlternateIconName(...)
}
}
}
Another unexplained curious thing I noticed is that after making these API calls in AppDelegate, my original code starts to work 😳
I'll provide some more information about my project, in case it helps. My project uses a modular architecture, and I use Tuist to generate the .xcodeproj and .xcworkspace files. The code that's causing the crash is located in a SwiftPM package. Additionally, the allTasks code is in one package, while setAlternateIconName() is in another. Tuist generates subprojects with statically linked frameworks from these SwiftPM packages.
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags: