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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[馃悰] Could not build module 'React' #2158

Open
Dozorov opened this issue Jun 22, 2023 · 47 comments
Open

[馃悰] Could not build module 'React' #2158

Dozorov opened this issue Jun 22, 2023 · 47 comments

Comments

@Dozorov
Copy link

Dozorov commented Jun 22, 2023

Description

XCode can't build a package.

How to repeat issue and example

*/node_modules/react-native-image-picker/ios/ImagePickerManager.h:1:9 Could not build module 'React'

Additional Information

  • Image Picker version: [5.6.0]
  • React Native version: [7.2.0]
  • Platform: [IOS]
  • Development Operating System: [MacOS]
  • Dev tools: [XCode]
@hachther
Copy link

Same issue

@Netocs
Copy link

Netocs commented Jun 24, 2023

Same issue after update RN 0.72

@AMINEDGE
Copy link

I have the same issue
the package nam in PackageList.java file is undefined.ImagePickerPackage in version 5.6.0
so I downgraded to 5.4.2 but after picking image from image library, app crashes with no error
I guess it's something with newer sdk and android versions

my emulator android version is 11
and react native version is 0.66.4

@miinos
Copy link

miinos commented Jun 25, 2023

a quick workaround is to allow Non-modular Includes In Framework Modules in Build Settings;

Capture d鈥檈虂cran 2023-06-25 a虁 19 44 18

@ivanignatiev
Copy link

May be, I have the same issue, more detailed error:

  • react-native-image-picker - 5.6.0
  • react-native - 0.72.0
CompileC /Users/**user**/Library/Developer/Xcode/DerivedData/**app**-gwouxwcliqndnnfddltnolbfqcuq/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/react-native-image-picker.build/Objects-normal/x86_64/ImagePickerManager.o /Users/**user**/Documents/GitHub/**app**/node_modules/react-native-image-picker/ios/ImagePickerManager.mm normal x86_64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'react-native-image-picker' from project 'Pods')
    cd /Users/**user**/Documents/GitHub/**app**/ios/Pods
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c++ -ivfsstatcache /Users/**user**/Library/Developer/Xcode/DerivedData/SDKStatCaches.noindex/iphonesimulator16.4-20E238-.sdkstatcache -target x86_64-apple-ios11.0-simulator -fmessage-length\=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -std\=gnu++14 -stdlib\=libc++ -fobjc-arc -fobjc-weak -fmodules -gmodules -fmodules-cache-path\=/Users/**user**/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -fmodules-prune-interval\=86400 -fmodules-prune-after\=345600 -fbuild-session-file\=/Users/**user**/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror\=non-modular-include-in-framework-module -fmodule-name\=react_native_image_picker -Wno-trigraphs -fpascal-strings -O0 -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Werror\=return-type -Wdocumentation -Wunreachable-code -Wno-implicit-atomic-properties -Werror\=deprecated-objc-isa-usage -Wno-objc-interface-ivars -Werror\=objc-root-class -Wno-arc-repeated-use-of-weak -Wimplicit-retain-self -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion -Wshorten-64-to-32 -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wdeprecated-implementations -Wno-c++11-extensions -Wno-implicit-fallthrough -DPOD_CONFIGURATION_DEBUG\=1 -DDEBUG\=1 -DCOCOAPODS\=1 -D_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION -DOBJC_OLD_DISPATCH_PROTOTYPES\=0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.4.sdk -fasm-blocks -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -Winvalid-offsetof -g -fvisibility-inlines-hidden -Wno-sign-conversion -Winfinite-recursion -Wmove -Wcomma -Wblock-capture-autoreleasing -Wstrict-prototypes -Wrange-loop-analysis -Wno-semicolon-before-method-body -Wunguarded-availability -fobjc-abi-version\=2 -fobjc-legacy-dispatch -index-store-path /Users/**user**/Library/Developer/Xcode/DerivedData/**app**-gwouxwcliqndnnfddltnolbfqcuq/Index.noindex/DataStore -iquote /Users/**user**/Library/Developer/Xcode/DerivedData/**app**-gwouxwcliqndnnfddltnolbfqcuq/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/react-native-image-picker.build/react_native_image_picker-generated-files.hmap -I/Users/**user**/Library/Developer/Xcode/DerivedData/**app**-gwouxwcliqndnnfddltnolbfqcuq/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/react-native-image-picker.build/react_native_image_picker-own-target-headers.hmap -I/Users/**user**/Library/Developer/Xcode/DerivedData/**app**-gwouxwcliqndnnfddltnolbfqcuq/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/react-native-image-picker.build/react_native_image_picker-all-non-framework-target-headers.hmap -ivfsoverlay /Users/**user**/Library/Developer/Xcode/DerivedData/**app**-gwouxwcliqndnnfddltnolbfqcuq/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/react-native-image-picker.build/all-product-headers.yaml -iquote /Users/**user**/Library/Developer/Xcode/DerivedData/**app**-gwouxwcliqndnnfddltnolbfqcuq/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/react-native-image-picker.build/react_native_image_picker-project-headers.hmap -I/Users/**user**/Library/Developer/Xcode/DerivedData/**app**-gwouxwcliqndnnfddltnolbfqcuq/Build/Products/Debug-iphonesimulator/react-native-image-picker/include -I/Users/**user**/Library/Developer/Xcode/DerivedData/**app**-gwouxwcliqndnnfddltnolbfqcuq/Build/Products/Debug-iphonesimulator/ReactCommon-Samples/ReactCommon_Samples.framework/Headers -I/Users/**user**/Library/Developer/Xcode/DerivedData/**app**-gwouxwcliqndnnfddltnolbfqcuq/Build/Products/Debug-iphonesimulator/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core -I/Users/**user**/Library/Developer/Xcode/DerivedData/**app**-gwouxwcliqndnnfddltnolbfqcuq/Build/Products/Debug-iphonesimulator/ReactCommon-Samples/ReactCommon_Samples.framework/Headers/platform/ios -I/Users/**user**/Library/Developer/Xcode/DerivedData/**app**-gwouxwcliqndnnfddltnolbfqcuq/Build/Products/Debug-iphonesimulator/React-NativeModulesApple/React_NativeModulesApple.framework/Headers -I/Users/**user**/Library/Developer/Xcode/DerivedData/**app**-gwouxwcliqndnnfddltnolbfqcuq/Build/Products/Debug-iphonesimulator/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios -I/Users/**user**/Documents/GitHub/**app**/ios/Pods/Headers/Public -I/Users/**user**/Documents/GitHub/**app**/ios/Pods/Headers/Public/React-callinvoker -I/Users/**user**/Documents/GitHub/**app**/ios/Pods/Headers/Public/React-runtimeexecutor -I/Users/**user**/Library/Developer/Xcode/DerivedData/**app**-gwouxwcliqndnnfddltnolbfqcuq/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/react-native-image-picker.build/DerivedSources-normal/x86_64 -I/Users/**user**/Library/Developer/Xcode/DerivedData/**app**-gwouxwcliqndnnfddltnolbfqcuq/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/react-native-image-picker.build/DerivedSources/x86_64 -I/Users/**user**/Library/Developer/Xcode/DerivedData/**app**-gwouxwcliqndnnfddltnolbfqcuq/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/react-native-image-picker.build/DerivedSources -F/Users/**user**/Library/Developer/Xcode/DerivedData/**app**-gwouxwcliqndnnfddltnolbfqcuq/Build/Products/Debug-iphonesimulator/react-native-image-picker -F/Users/**user**/Library/Developer/Xcode/DerivedData/**app**-gwouxwcliqndnnfddltnolbfqcuq/Build/Products/Debug-iphonesimulator/DoubleConversion -F/Users/**user**/Library/Developer/Xcode/DerivedData/**app**-gwouxwcliqndnnfddltnolbfqcuq/Build/Products/Debug-iphonesimulator/RCT-Folly -F/Users/**user**/Library/Developer/Xcode/DerivedData/**app**-gwouxwcliqndnnfddltnolbfqcuq/Build/Products/Debug-iphonesimulator/React-Core -F/Users/**user**/Library/Developer/Xcode/DerivedData/**app**-gwouxwcliqndnnfddltnolbfqcuq/Build/Products/Debug-iphonesimulator/React-cxxreact -F/Users/**user**/Library/Developer/Xcode/DerivedData/**app**-gwouxwcliqndnnfddltnolbfqcuq/Build/Products/Debug-iphonesimulator/React-debug -F/Users/**user**/Library/Developer/Xcode/DerivedData/**app**-gwouxwcliqndnnfddltnolbfqcuq/Build/Products/Debug-iphonesimulator/React-jsc -F/Users/**user**/Library/Developer/Xcode/DerivedData/**app**-gwouxwcliqndnnfddltnolbfqcuq/Build/Products/Debug-iphonesimulator/React-jsi -F/Users/**user**/Library/Developer/Xcode/DerivedData/**app**-gwouxwcliqndnnfddltnolbfqcuq/Build/Products/Debug-iphonesimulator/React-jsiexecutor -F/Users/**user**/Library/Developer/Xcode/DerivedData/**app**-gwouxwcliqndnnfddltnolbfqcuq/Build/Products/Debug-iphonesimulator/React-jsinspector -F/Users/**user**/Library/Developer/Xcode/DerivedData/**app**-gwouxwcliqndnnfddltnolbfqcuq/Build/Products/Debug-iphonesimulator/React-logger -F/Users/**user**/Library/Developer/Xcode/DerivedData/**app**-gwouxwcliqndnnfddltnolbfqcuq/Build/Products/Debug-iphonesimulator/React-perflogger -F/Users/**user**/Library/Developer/Xcode/DerivedData/**app**-gwouxwcliqndnnfddltnolbfqcuq/Build/Products/Debug-iphonesimulator/React-utils -F/Users/**user**/Library/Developer/Xcode/DerivedData/**app**-gwouxwcliqndnnfddltnolbfqcuq/Build/Products/Debug-iphonesimulator/SocketRocket -F/Users/**user**/Library/Developer/Xcode/DerivedData/**app**-gwouxwcliqndnnfddltnolbfqcuq/Build/Products/Debug-iphonesimulator/Yoga -F/Users/**user**/Library/Developer/Xcode/DerivedData/**app**-gwouxwcliqndnnfddltnolbfqcuq/Build/Products/Debug-iphonesimulator/fmt -F/Users/**user**/Library/Developer/Xcode/DerivedData/**app**-gwouxwcliqndnnfddltnolbfqcuq/Build/Products/Debug-iphonesimulator/glog -fcxx-modules -include /Users/**user**/Documents/GitHub/**app**/ios/Pods/Target\ Support\ Files/react-native-image-picker/react-native-image-picker-prefix.pch -MMD -MT dependencies -MF /Users/**user**/Library/Developer/Xcode/DerivedData/**app**-gwouxwcliqndnnfddltnolbfqcuq/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/react-native-image-picker.build/Objects-normal/x86_64/ImagePickerManager.d --serialize-diagnostics /Users/**user**/Library/Developer/Xcode/DerivedData/**app**-gwouxwcliqndnnfddltnolbfqcuq/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/react-native-image-picker.build/Objects-normal/x86_64/ImagePickerManager.dia -c /Users/**user**/Documents/GitHub/**app**/node_modules/react-native-image-picker/ios/ImagePickerManager.mm -o /Users/**user**/Library/Developer/Xcode/DerivedData/**app**-gwouxwcliqndnnfddltnolbfqcuq/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/react-native-image-picker.build/Objects-normal/x86_64/ImagePickerManager.o -index-unit-output-path /Pods.build/Debug-iphonesimulator/react-native-image-picker.build/Objects-normal/x86_64/ImagePickerManager.o
While building module 'React' imported from /Users/**user**/Documents/GitHub/**app**/node_modules/react-native-image-picker/ios/ImagePickerManager.h:1:
In file included from <module-includes>:1:
In file included from /Users/**user**/Documents/GitHub/**app**/ios/Pods/Target Support Files/React-Core/React-Core-umbrella.h:88:
/Users/**user**/Documents/GitHub/**app**/node_modules/react-native/React/Base/RCTRuntimeExecutorFromBridge.h:10:9: error: include of non-modular header inside framework module 'React.RCTRuntimeExecutorFromBridge': '/Users/**user**/Documents/GitHub/**app**/ios/Pods/Headers/Public/React-runtimeexecutor/ReactCommon/RuntimeExecutor.h' [-Werror,-Wnon-modular-include-in-framework-module]
#import <ReactCommon/RuntimeExecutor.h>
        ^
While building module 'React' imported from /Users/**user**/Documents/GitHub/**app**/node_modules/react-native-image-picker/ios/ImagePickerManager.h:1:
While building module 'jsi' imported from /Users/**user**/Documents/GitHub/**app**/ios/Pods/Headers/Public/React-runtimeexecutor/ReactCommon/RuntimeExecutor.h:13:
In file included from <module-includes>:1:
In file included from /Users/**user**/Documents/GitHub/**app**/ios/Pods/Target Support Files/React-jsi/React-jsi-umbrella.h:17:
/Users/**user**/Documents/GitHub/**app**/node_modules/react-native/ReactCommon/jsi/jsi/JSIDynamic.h:10:10: fatal error: 'folly/dynamic.h' file not found
#include <folly/dynamic.h>
         ^~~~~~~~~~~~~~~~~
/Users/**user**/Documents/GitHub/**app**/node_modules/react-native/ReactCommon/jsi/jsi/JSIDynamic.h:10:10: note: did not find header 'dynamic.h' in framework 'folly' (loaded from '/Users/**user**/Library/Developer/Xcode/DerivedData/**app**-gwouxwcliqndnnfddltnolbfqcuq/Build/Products/Debug-iphonesimulator/RCT-Folly')
1 error generated.
While building module 'React' imported from /Users/**user**/Documents/GitHub/**app**/node_modules/react-native-image-picker/ios/ImagePickerManager.h:1:
In file included from <module-includes>:1:
In file included from /Users/**user**/Documents/GitHub/**app**/ios/Pods/Target Support Files/React-Core/React-Core-umbrella.h:88:
In file included from /Users/**user**/Documents/GitHub/**app**/node_modules/react-native/React/Base/RCTRuntimeExecutorFromBridge.h:10:
/Users/**user**/Documents/GitHub/**app**/ios/Pods/Headers/Public/React-runtimeexecutor/ReactCommon/RuntimeExecutor.h:13:10: fatal error: could not build module 'jsi'
#include <jsi/jsi.h>
 ~~~~~~~~^
3 errors generated.
In file included from /Users/**user**/Documents/GitHub/**app**/node_modules/react-native-image-picker/ios/ImagePickerManager.mm:1:
/Users/**user**/Documents/GitHub/**app**/node_modules/react-native-image-picker/ios/ImagePickerManager.h:1:9: fatal error: could not build module 'React'
#import <React/RCTBridgeModule.h>
 ~~~~~~~^
4 errors generated.

@wanderlust252
Copy link

image
work for me

@nskate
Copy link

nskate commented Jun 29, 2023

Put this code in the post_install do |installer| loop in the Podfile, so it looks like this:

post_install do |installer|

    installer.pods_project.build_configurations.each do |config|
      config.build_settings["CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES"] = true
    end

end

I tried updating it in the Xcodes but it did not work. The modifying the Podfile worked for me. This is the same method @wanderlust252 posted, in text.

@AMINEDGE
Copy link

can someone give a workaround for android part?

@AlekseyP18
Copy link

The same issue

@prateekuttreja2020
Copy link

i am having the same issue.. any work around >

@prateekuttreja2020
Copy link

image work for me

not working for me....
react-native-image-picker - 5.6.0
react-native - 0.72.1

@mhackeras
Copy link

mhackeras commented Jul 8, 2023

Basically the workaround worked. Not sure if it's ideal though.

image-picker - 5.6.0
react-native - 0.72.1

Anyone has an idea why the react module causes this error? I can't really understand or find a solution to the issue myself.

@cyim02
Copy link

cyim02 commented Jul 9, 2023

The workaround does not work for me...

react-native-image-picker - 5.6.0
react-native - 0.72.1

@hellogbg
Copy link

This didn't work for me.
I have:

  • "react-native-image-picker": "5.6.0",
  • "react-native": "0.72.3",

image
work for me

@saeed9321
Copy link

This didn't work for me. I have:

  • "react-native-image-picker": "5.6.0",
  • "react-native": "0.72.3",

image
work for me

This worked for me.

@minhthuhai
Copy link

i tried and there is no version compatible with react-native 0.72

@imransilvake
Copy link

same issue. upgraded from 0.71 to 0.73 and its not working for me

@Robiullah2244
Copy link

Same issue for me in version 0.72.3

@willryanuk
Copy link

Same issue for me. The only work around I found was to downgrade react-native-image-picker to version 5.0.2

@HSReact
Copy link

HSReact commented Jul 27, 2023

is this going to be updated? anyone? help

@lfoliveir4
Copy link

Downgrade 5.0.2 it's work's for me

@HSReact
Copy link

HSReact commented Aug 2, 2023

Downgrade 5.0.2 it's work's for me

Yes this is working, thank you.

Only concern is that 5.0.2 version is 6 months old so at some stage it will start creating problems with newer RN builds.

@erdenemunkh
Copy link

Same issue

@imransilvake
Copy link

any update on this issue?

@yagofrancia
Copy link

Same here.

@dsipahioglu
Copy link

Any updates? Doesn't work in RN 72.3 and react-native-image-picker: 5.6.0

@StasNemy
Copy link

StasNemy commented Aug 16, 2023

Hey every one!

Put this code in the post_install do |installer| loop in the Podfile, so it looks like this:

post_install do |installer|

installer.pods_project.build_configurations.each do |config|
  config.build_settings["CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES"] = true
end

end
I tried updating it in the Xcodes but it did not work. The modifying the Podfile worked for me. This is the same method @wanderlust252 posted, in text.

The process works for me. When I run Product > Build, there are no errors, and the build is successful. @nskate

If you encounter errors, please indicate the number of errors and provide the settings from the Podfile. This can help in diagnosing the issue.

@harlandjp
Copy link

installer.pods_project.build_configurations.each do |config|
  config.build_settings["CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES"] = true
end

Didn't fix it for me, I get the error:

XXXX/node_modules/react-native/React/Base/RCTRuntimeExecutorFromBridge.h:10:9 Include of non-modular header inside framework module 'React.RCTRuntimeExecutorFromBridge': XXXX/ios/Pods/Headers/Public/React-runtimeexecutor/ReactCommon/RuntimeExecutor.h'

@jwandekoken
Copy link

Put this code in the post_install do |installer| loop in the Podfile, so it looks like this:

post_install do |installer|

    installer.pods_project.build_configurations.each do |config|
      config.build_settings["CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES"] = true
    end

end

I tried updating it in the Xcodes but it did not work. The modifying the Podfile worked for me. This is the same method @wanderlust252 posted, in text.

This solution worked for me. Thanks! The build issue was happening only on ios. On Android it was working fine.

@charleston10
Copy link

Yes this is working, thank you.

Only concern is that 5.0.2 version is 6 months old so at some stage it will start creating problems with newer RN builds.

Same problem

@MiguelAraCo
Copy link

I had to do the following to get it working on version 5.6.1 and RN 0.72.4:

  • Update the setting in Xcode (Project > Build Settings > Apple Clang - Language - Modules > Allow Non-modular includes in Framework Modules)
  • Set the setting in the Podfile as mentioned here
  • Run bundle exec pod install --clean-install inside the ios directory

@habovh
Copy link

habovh commented Aug 28, 2023

Having the issue here as well, and I fail to understand why the React import in the native module would fail for this library when others are importing #import <React/RCTBridgeModule.h> the exact same way but yet don't require the CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES flag hack. I'd be more than happy to be able to contribute here but must admit I'm stumped.

@kdpadhiyar
Copy link

Hello I am not able to fix this same issue please lend me a hand to fix this

@BryanMwangi
Copy link

I had to do the following to get it working on version 5.6.1 and RN 0.72.4:

  • Update the setting in Xcode (Project > Build Settings > Apple Clang - Language - Modules > Allow Non-modular includes in Framework Modules)
  • Set the setting in the Podfile as mentioned here
  • Run bundle exec pod install --clean-install inside the ios directory

This worked perfectly for me. Personally I am on:
RN '0.72.4' and react-native-image-picker: "^7.0.0"

@JohnFTitor
Copy link

Works for me on 5.0.2, however I did need to clean up my cache so take that in mind when making this change

@Kiran-codeberg
Copy link

I had to do the following to get it working on version 5.6.1 and RN 0.72.4:

Update the setting in Xcode (Project > Build Settings > Apple Clang - Language - Modules > Allow Non-modular includes in Framework Modules)
Set the setting in the Podfile as mentioned #2158 (comment)
Run bundle exec pod install --clean-install inside the ios directory

not working for me
I am on:
RN '0.72.4' and react-native-image-picker: "^7.0.0"

@zahid502
Copy link

@Kiran-codeberg
It's( worked for me,
I think you have used post_install do |installer| two times.

I'm using the same version as you,
RN '0.72.4' and react-native-image-picker: "^7.0.0"

Just adding in Podfile at post_install do |installer|

installer.pods_project.build_configurations.each do |config|
config.build_settings["CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES"] = true
end

react-native-image-picker

@fernandocvargas
Copy link

I had to do the following to get it working on version 5.6.1 and RN 0.72.4:

  • Update the setting in Xcode (Project > Build Settings > Apple Clang - Language - Modules > Allow Non-modular includes in Framework Modules)
  • Set the setting in the Podfile as mentioned here
  • Run bundle exec pod install --clean-install inside the ios directory

For me it worked perfectly.
"react-native": "0.72.4"
"react-native-image-picker": "^7.0.0"

Mentioned in here

@ngxhuyhoang
Copy link

Put this code in the post_install do |installer| loop in the Podfile, so it looks like this:

post_install do |installer|

    installer.pods_project.build_configurations.each do |config|
      config.build_settings["CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES"] = true
    end

end

I tried updating it in the Xcodes but it did not work. The modifying the Podfile worked for me. This is the same method @wanderlust252 posted, in text.

Hello guys

This code is not change CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES in project.pbxproj then not working.
Help me to fix it

Thank you so much

@nijarv
Copy link

nijarv commented Oct 11, 2023

Is there any fix for the issue???

@riku99
Copy link

riku99 commented Nov 19, 2023

I also faced the same issue and after some investigation, I suspect the problem might be caused by the -fcxx-modules in the podspec. Making the following changes resulted in a successful build:

In short, the solution involves:

Removing s.pod_target_xcconfig = { 'OTHER_CPLUSPLUSFLAGS' => '-fcxx-modules' } from react-native-image-picker.podspec
Relocating 'OTHER_CPLUSPLUSFLAGS' => '-fcxx-modules'
Next, change @import MobileCoreServices in ImagePickerManager.mm to #import <MobileCoreServices/MobileCoreServices.h>

Below is the patch file for reference.

diff --git a/node_modules/react-native-image-picker/ios/ImagePickerManager.mm b/node_modules/react-native-image-picker/ios/ImagePickerManager.mm
index cce30e2..c59f07d 100644
--- a/node_modules/react-native-image-picker/ios/ImagePickerManager.mm
+++ b/node_modules/react-native-image-picker/ios/ImagePickerManager.mm
@@ -5,7 +5,7 @@
#import <Photos/Photos.h>
#import <PhotosUI/PhotosUI.h>

-@import MobileCoreServices;
+#import <MobileCoreServices/MobileCoreServices.h>

@interface ImagePickerManager ()

diff --git a/node_modules/react-native-image-picker/react-native-image-picker.podspec b/node_modules/react-native-image-picker/react-native-image-picker.podspec
index 225f965..de321b5 100644
--- a/node_modules/react-native-image-picker/react-native-image-picker.podspec
+++ b/node_modules/react-native-image-picker/react-native-image-picker.podspec
@@ -14,14 +14,14 @@ Pod::Spec.new do |s|

s.source       = { :git => "https://github.com/react-native-image-picker/react-native-image-picker.git", :tag => "v#{s.version}" }
s.source_files  = "ios/*.{h,m,mm}"
-  s.pod_target_xcconfig = { 'OTHER_CPLUSPLUSFLAGS' => '-fcxx-modules' }

if ENV['RCT_NEW_ARCH_ENABLED'] == '1'
  folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'

  s.pod_target_xcconfig = {
    'HEADER_SEARCH_PATHS' => '"$(PODS_ROOT)/boost" "$(PODS_ROOT)/boost-for-react-native" "$(PODS_ROOT)/RCT-Folly"',
-      'CLANG_CXX_LANGUAGE_STANDARD' => 'c++17'
+      'CLANG_CXX_LANGUAGE_STANDARD' => 'c++17',
+      'OTHER_CPLUSPLUSFLAGS' => '-fcxx-modules'
  }

  s.compiler_flags  = folly_compiler_flags + ' -DRN_FABRIC_ENABLED -fmodules -fcxx-modules'

The versions I am using are:

"react-native": "0.72.6",
"react-native-image-picker": "^7.0.2".

@parnekov
Copy link

Same issue for me. The only work around I found was to downgrade react-native-image-picker to version 5.0.2

worked for me RN 0.72.7

@KrisLau
Copy link

KrisLau commented Nov 28, 2023

@riku99 maybe make that into a PR for the repo and hopefully the maintainer sees it

@williamgurzoni
Copy link

Having the same issue.
Apple website says that using CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES is unsafe.

Did anyone find out what's the reason for this issue?

@vitaliyrd
Copy link

vitaliyrd commented Dec 1, 2023

The build failures are probably related to this. Looks like there's an open PR which fixes this for me (react-native 0.72.7 and react-native-image-picker 7.03).

@neyosoft
Copy link

That PR has been merged into the react-native-image-picker 7.1.0 release. This has fixed this issue for me on RN 0.72.5

@ils-anwarshah
Copy link

react-native-image-picker 7.1.0 release. This has fixed this issue for me

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

No branches or pull requests