prscX / react-native-photo-editor

React Native: Native Photo Editor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

iOS Build failed After the pod file configuration

muralitharanaspritle opened this issue · comments

Screenshot 2022-10-19 at 12 21 37 PM

Firstly, This package is amazing thanks for the contributors. In android this package working perfectly however I am facing error when I build the app after pod file changes.

The error is like

local.file not found,
Showing All Errors Only
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:10: Could not build module 'CoreFoundation'
etc.,

Please help me !
@prscX

My pod file is here,

`
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '12.4'
install! 'cocoapods', :deterministic_uuids => false

target 'ImageEditor' do

pod 'RNFS', :path => '../node_modules/react-native-fs'
config = use_native_modules!

pod 'RNPhotoEditor', :path => '../node_modules/react-native-photo-editor/ios'

use_frameworks! :linkage => :static

pod 'iOSPhotoEditor', :git => 'https://github.com/prscX/photo-editor', :branch => 'master'

Flags change depending on the env values.

flags = get_default_flags()

use_react_native!(
:path => config[:reactNativePath],
# Hermes is now enabled by default. Disable by setting this flag to false.
# Upcoming versions of React Native may rely on get_default_flags(), but
# we make it explicit here to aid in the React Native upgrade process.
:hermes_enabled => true,
:fabric_enabled => flags[:fabric_enabled],
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable the next line.
:flipper_configuration => FlipperConfiguration.enabled,
# An absolute path to your application root.
:app_path => "#{Pod::Config.instance.installation_root}/.."
)

target 'ImageEditorTests' do
inherit! :complete
# Pods for testing
end

post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name.include?('iOSPhotoEditor')
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '5'
end
end
end
react_native_post_install(
installer,
# Set mac_catalyst_enabled to true in order to apply patches
# necessary for Mac Catalyst builds
:mac_catalyst_enabled => false
)
__apply_Xcode_12_5_M1_post_install_workaround(installer)
end

Follow Flipper iOS Setup Guidelines

This is required because iOSPhotoEditor is implemented using Swift and we have to use use_frameworks! in Podfile

$static_framework = ['FlipperKit', 'Flipper', 'Flipper-Folly',
'CocoaAsyncSocket', 'ComponentKit', 'Flipper-DoubleConversion',
'Flipper-Glog', 'Flipper-PeerTalk', 'Flipper-RSocket', 'Yoga', 'YogaKit',
'CocoaLibEvent', 'OpenSSL-Universal', 'boost-for-react-native']

pre_install do |installer|
Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
installer.pod_targets.each do |pod|
if $static_framework.include?(pod.name)
def pod.build_type;
Pod::BuildType.static_library
end
end
end
end

end
`

Versions:

React Native : 0.70.2
Xcode : 14.0.1 (14A400)
Device: Mac mini (M1)

Thanks in Advance!!

Notes: React-Native-Firebase uses use_frameworks, which has compatibility issues with Flipper, Hermes & Fabric.

Flipper: use_frameworks is not compatible with Flipper. You need to disable Flipper by commenting out the :flipper_configuration line in your Podfile.

Hermes: a fix was put in place in react-native release 0.69.1 that allows Hermes to work with use_frameworks!. To use use_frameworks with Hermes, make sure you have set static linkage with use_frameworks! :linkage => :static.

New Architecture: Fabric is not compatible with use_frameworks!. Community support to help fix use_frameworks support for New Architecture is welcome!

so in Podfile file

Change this line
:flipper_configuration => FlipperConfiguration.enabled,

to
:flipper_configuration => FlipperConfiguration.disabled,

@muralitharanaspritle you saved my day. 🥹