Search code examples
iosflutterflutter-ios

Could not find a storyboard named 'NSPhotoLibraryUsageDescription' in bundle NSBundle in Flutter


I have a physical iPhone that I'm trying to run my Flutter code on. This is the error I'm getting. What's the issue?

Running "flutter pub get" in flutter_app...
Launching lib/main.dart on iPhone in debug mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: 8X88B473MR
Running pod install...
Running Xcode build...
Xcode build done.                                           47.5s
Installing and launching...
(lldb) 2022-05-03 21:25:14.382722-0700 Runner[442:24659] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Could not find a storyboard named 'NSPhotoLibraryUsageDescription' in bundle NSBundle </private/var/containers/Bundle/Application/1D4E3157-4B4B-415B-BE57-674B89A21BD4/Runner.app> (loaded)'
*** First throw call stack:
(0x1824b104c 0x19ab25f54 0x184ee2180 0x18497980c 0x1849f370c 0x184db73ac 0x184c14e44 0x184a6d62c 0x184b98b7c 0x184cb9380 0x184ef9f8c 0x184e85710 0x184a6e430 0x184b2e350 0x184a70340 0x184b5adf4 0x184fe2260 0x184a9ec60 0x184ae2524 0x184c19d70 0x184b590b4 0x193fa8e20 0x193fcecdc 0x193f896b4 0x193f8acf4 0x182123660 0x182127118 0x193f8af94 0x193f8a3d4 0x193f8e9e4 0x1824d3020 0x1824e3ce0 0x18241dfe8 0x1824237f4 0x1824373b8 0x19ddc738c 0x184dd76a8 0x184b567f4 0x1049fd554 0x104c7da24)
libc++abi: terminating with uncaught exception of type NSException
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
    frame #0: 0x00000001b92f8964 libsystem_kernel.dylib`__pthread_kill + 8
libsystem_kernel.dylib`__pthread_kill:
->  0x1b92f8964 <+8>:  b.lo   0x1b92f8984               ; <+40>
    0x1b92f8968 <+12>: pacibsp 
    0x1b92f896c <+16>: stp    x29, x30, [sp, #-0x10]!
    0x1b92f8970 <+20>: mov    x29, sp
Target 0: (Runner) stopped.
Error launching application on iPhone.

Solution

  • have you tried to add on the info.plist in ios folder on your project

    project/ ios / Runner / Info.plist

    and inside on the file adding this line

    <key>NSPhotoLibraryAddUsageDescription</key>
    <string>Our application needs permission to write photos...</string>
    <key>NSPhotoLibraryUsageDescription</key>
    <string>This app requires access to photos, gallery, files and etc.. library for attachments messages </string>
    

    if not try to put this then try to run.