'Error at startup on iOS app: "dependent dylib '@rpath/libswift_Concurrency.dylib' not found"

In my Flutter project, I try to launch my app on an iOS device, which had always worked so far.

But after a few month not working on my project, I came back recently and I have an error: when I compile and run my app (in debug mode only), it compiles without any problem, but now my app crashes at startup, and I have the following error:

(lldb) dyld: dependent dylib '@rpath/libswift_Concurrency.dylib' not found for '/private/var/containers/Bundle/Application/987233C3-A768-49D5-A4AF-27298B85157B/Runner.app/Runner'. chained fixups, seg_count exceeds number of segments
* thread #1, stop reason = signal SIGABRT
    frame #0: 0x000000010611d848 dyld`__abort_with_payload + 8
dyld`__abort_with_payload:
->  0x10611d848 <+8>:  b.lo   0x10611d868               ; <+40>
    0x10611d84c <+12>: pacibsp 
    0x10611d850 <+16>: stp    x29, x30, [sp, #-0x10]!
    0x10611d854 <+20>: mov    x29, sp
Target 0: (Runner) stopped.

I'm fairly new to iOS development and I have no idea what to do, despite my research. I also tried flutter clean, but still not working.

I use Xcode 13.2.1 and I run my app on an iPhone 11 with iOS 14.7.1.

That being said, I tried with an emulator with iOS 15.2 and it works fine. I also tried on a real iPhone, but in release mode this time, and it works too.

How can I fix the problem when I run my app on my device?

Thanks.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source