Ran pod install
right after creating a new React Native project and ejecting to Expokit.
Install all pod dependencies correctly.
I got the following error during the post install process...
Generating Pods project
[!] An error occurred while processing the post-install hook of the Podfile.
undefined method `native_target' for /ReactNativeTestApp/ios/Podfile:123:in https://gitlab.com/bpshonyak/reactnativetestapp I was able to fix the issue by downgrading to CocoaPods version 1.5.3block (4 levels) in from_ruby'
/ReactNativeTestApp/ios/Podfile:107:in
each'
/ReactNativeTestApp/ios/Podfile:107:in block (3 levels) in from_ruby'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-core-1.6.0.beta.1/lib/cocoapods-core/podfile.rb:179:in
post_install!'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.0.beta.1/lib/cocoapods/installer.rb:685:in run_podfile_post_install_hook'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.0.beta.1/lib/cocoapods/installer.rb:673:in
block in run_podfile_post_install_hooks'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.0.beta.1/lib/cocoapods/user_interface.rb:145:in message'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.0.beta.1/lib/cocoapods/installer.rb:672:in
run_podfile_post_install_hooks'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.0.beta.1/lib/cocoapods/installer.rb:197:in block in generate_pods_project'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.0.beta.1/lib/cocoapods/user_interface.rb:64:in
section'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.0.beta.1/lib/cocoapods/installer.rb:194:in generate_pods_project'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.0.beta.1/lib/cocoapods/installer.rb:125:in
install!'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.0.beta.1/lib/cocoapods/command/install.rb:48:in run'
/Library/Ruby/Gems/2.3.0/gems/claide-1.0.2/lib/claide/command.rb:334:in
run'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.0.beta.1/lib/cocoapods/command.rb:52:in run'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.0.beta.1/bin/pod:55:in
load'
/usr/local/bin/pod:22:in
CocoaPods Environment
Stack
CocoaPods : 1.6.0.beta.1
Ruby : ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin17]
RubyGems : 2.5.2.3
Host : Mac OS X 10.13.6 (17G65)
Xcode : 10.0 (10A255)
Git : git version 2.6.4
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib
Repositories : master - https://github.com/CocoaPods/Specs.git @ 6737764d17f790a9a6791d35b1fe60eb8eefa859
Installation Source
Executable Path: /usr/local/bin/pod
Plugins
cocoapods-deintegrate : 1.0.2
cocoapods-plugins : 1.0.0
cocoapods-search : 1.0.0
cocoapods-stats : 1.0.0
cocoapods-trunk : 1.3.1
cocoapods-try : 1.1.0
Podfile
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
target 'reactnativetestapp' do
pod 'ExpoKit',
:git => "http://github.com/expo/expo.git",
:tag => "ios/2.8.3",
:subspecs => [
"Core"
],
:inhibit_warnings => true
pod 'EXAdsAdMob',
:path => "../node_modules/expo-ads-admob/ios"
pod 'EXBarCodeScanner',
:path => "../node_modules/expo-barcode-scanner/ios"
pod 'EXBarCodeScannerInterface',
:path => "../node_modules/expo-barcode-scanner-interface/ios"
pod 'EXCamera',
:path => "../node_modules/expo-camera/ios"
pod 'EXCameraInterface',
:path => "../node_modules/expo-camera-interface/ios"
pod 'EXConstants',
:path => "../node_modules/expo-constants/ios"
pod 'EXConstantsInterface',
:path => "../node_modules/expo-constants-interface/ios"
pod 'EXContacts',
:path => "../node_modules/expo-contacts/ios"
pod 'EXCore',
:path => "../node_modules/expo-core/ios"
pod 'EXFaceDetectorInterface',
:path => "../node_modules/expo-face-detector-interface/ios"
pod 'EXFileSystem',
:path => "../node_modules/expo-file-system/ios"
pod 'EXFileSystemInterface',
:path => "../node_modules/expo-file-system-interface/ios"
pod 'EXFont',
:path => "../node_modules/expo-font/ios"
pod 'EXFontInterface',
:path => "../node_modules/expo-font-interface/ios"
pod 'EXGL',
:path => "../node_modules/expo-gl/ios"
pod 'EXGL-CPP',
:path => "../node_modules/expo-gl-cpp/cpp"
pod 'EXImageLoaderInterface',
:path => "../node_modules/expo-image-loader-interface/ios"
pod 'EXLocalAuthentication',
:path => "../node_modules/expo-local-authentication/ios"
pod 'EXLocation',
:path => "../node_modules/expo-location/ios"
pod 'EXMediaLibrary',
:path => "../node_modules/expo-media-library/ios"
pod 'EXPaymentsStripe',
:path => "../node_modules/expo-payments-stripe/ios"
pod 'EXPermissions',
:path => "../node_modules/expo-permissions/ios"
pod 'EXPermissionsInterface',
:path => "../node_modules/expo-permissions-interface/ios"
pod 'EXPrint',
:path => "../node_modules/expo-print/ios"
pod 'EXReactNativeAdapter',
:path => "../node_modules/expo-react-native-adapter/ios"
pod 'EXSegment',
:path => "../node_modules/expo-analytics-segment/ios"
pod 'EXSensors',
:path => "../node_modules/expo-sensors/ios"
pod 'EXSensorsInterface',
:path => "../node_modules/expo-sensors-interface/ios"
pod 'EXSMS',
:path => "../node_modules/expo-sms/ios"
pod 'React',
:path => "../node_modules/react-native",
:inhibit_warnings => true,
:subspecs => [
"Core",
"ART",
"RCTActionSheet",
"RCTAnimation",
"RCTCameraRoll",
"RCTGeolocation",
"RCTImage",
"RCTNetwork",
"RCTText",
"RCTVibration",
"RCTWebSocket",
"DevSupport",
"CxxBridge"
]
pod 'yoga',
:path => "../node_modules/react-native/ReactCommon/yoga",
:inhibit_warnings => true
pod 'DoubleConversion',
:podspec => "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec",
:inhibit_warnings => true
pod 'Folly',
:podspec => "../node_modules/react-native/third-party-podspecs/Folly.podspec",
:inhibit_warnings => true
pod 'glog',
:podspec => "../node_modules/react-native/third-party-podspecs/glog.podspec",
:inhibit_warnings => true
post_install do |installer|
installer.pods_project.main_group.tab_width = '2';
installer.pods_project.main_group.indent_width = '2';
installer.pod_targets.each do |target|
if target.pod_name == 'ExpoKit'
target.native_target.build_configurations.each do |config|
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)']
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'EX_DETACHED=1'
# needed for GoogleMaps 2.x
config.build_settings['FRAMEWORK_SEARCH_PATHS'] ||= []
config.build_settings['FRAMEWORK_SEARCH_PATHS'] << '${PODS_ROOT}/GoogleMaps/Base/Frameworks'
config.build_settings['FRAMEWORK_SEARCH_PATHS'] << '${PODS_ROOT}/GoogleMaps/Maps/Frameworks'
end
end
if ['Amplitude-iOS','Analytics','AppAuth','Branch','CocoaLumberjack','FBSDKCoreKit','FBSDKLoginKit','FBSDKShareKit','GPUImage','JKBigInteger2'].include? target.pod_name
target.native_target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
end
end
# Can't specify this in the React podspec because we need
# to use those podspecs for detached projects which don't reference ExponentCPP.
if target.pod_name.start_with?('React')
target.native_target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
config.build_settings['HEADER_SEARCH_PATHS'] ||= ['$(inherited)']
end
end
# Build React Native with RCT_DEV enabled
next unless target.pod_name == 'React'
target.native_target.build_configurations.each do |config|
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)']
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'RCT_DEV=1'
end
end
end
end
Project that demonstrates the issue
How I fixed the issue
This API changed in 1.6.0.beta.1. It is not meant to be public but it has been but we offer no guarantee for it breaking.
Use installer.target_installation_results
which contains all targets and their native targets that were created.
Going to close as this is still available for you to change.
Downgrade instructions:
sudo gem uninstall cocoapods
Y
when it asks whether to remove executablessudo gem install cocoapods -v 1.5.3
@gerbus that working with me thank you
@skaunited did it take along time to install glog ?
HELP NEEDED! I installed cocoapods -v 1.5.3, however, I'm still getting these errors. What should I do?
[!] An error occurred while processing the post-install hook of the Podfile.
undefined method `native_target' for <Pod::PodTarget name=Amplitude-iOS >:Pod::PodTarget
/Users/iryna/Documents/Projects/civic-champs-client/ios/Podfile:137:in `block (4 levels) in from_ruby'
/Users/iryna/Documents/Projects/civic-champs-client/ios/Podfile:121:in `each'
/Users/iryna/Documents/Projects/civic-champs-client/ios/Podfile:121:in `block (3 levels) in from_ruby'
/Users/iryna/.rvm/gems/ruby-2.6.0/gems/cocoapods-core-1.7.0.beta.3/lib/cocoapods-core/podfile.rb:179:in `post_install!'
/Users/iryna/.rvm/gems/ruby-2.6.0/gems/cocoapods-1.7.0.beta.3/lib/cocoapods/installer.rb:836:in `run_podfile_post_install_hook'
/Users/iryna/.rvm/gems/ruby-2.6.0/gems/cocoapods-1.7.0.beta.3/lib/cocoapods/installer.rb:824:in `block in run_podfile_post_install_hooks'
/Users/iryna/.rvm/gems/ruby-2.6.0/gems/cocoapods-1.7.0.beta.3/lib/cocoapods/user_interface.rb:145:in `message'
/Users/iryna/.rvm/gems/ruby-2.6.0/gems/cocoapods-1.7.0.beta.3/lib/cocoapods/installer.rb:823:in `run_podfile_post_install_hooks'
/Users/iryna/.rvm/gems/ruby-2.6.0/gems/cocoapods-1.7.0.beta.3/lib/cocoapods/installer.rb:309:in `block in create_and_save_projects'
/Users/iryna/.rvm/gems/ruby-2.6.0/gems/cocoapods-1.7.0.beta.3/lib/cocoapods/user_interface.rb:64:in `section'
/Users/iryna/.rvm/gems/ruby-2.6.0/gems/cocoapods-1.7.0.beta.3/lib/cocoapods/installer.rb:290:in `create_and_save_projects'
/Users/iryna/.rvm/gems/ruby-2.6.0/gems/cocoapods-1.7.0.beta.3/lib/cocoapods/installer.rb:281:in `generate_pods_project'
/Users/iryna/.rvm/gems/ruby-2.6.0/gems/cocoapods-1.7.0.beta.3/lib/cocoapods/installer.rb:159:in `install!'
/Users/iryna/.rvm/gems/ruby-2.6.0/gems/cocoapods-1.7.0.beta.3/lib/cocoapods/command/install.rb:51:in `run'
/Users/iryna/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'
/Users/iryna/.rvm/gems/ruby-2.6.0/gems/cocoapods-1.7.0.beta.3/lib/cocoapods/command.rb:52:in `run'
/Users/iryna/.rvm/gems/ruby-2.6.0/gems/cocoapods-1.7.0.beta.3/bin/pod:55:in `<top (required)>'
/Users/iryna/.rvm/gems/ruby-2.6.0/bin/pod:23:in `load'
/Users/iryna/.rvm/gems/ruby-2.6.0/bin/pod:23:in `<main>'
@gerbus mine bombed out on glog after downgrading to 1.5.3
:
Errno::ENOENT - No such file or directory @ rb_sysopen - /Users/michael.neeley/Documents/Projects/Apollos/ios/Pods/Local Podspecs/glog.podspec.json
/Library/Ruby/Gems/2.3.0/gems/cocoapods-core-1.5.3/lib/cocoapods-core/specification.rb:566:in `read'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-core-1.5.3/lib/cocoapods-core/specification.rb:566:in `checksum'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/downloader/request.rb:62:in `slug'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/downloader/cache.rb:114:in `path_for_spec'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/downloader/cache.rb:140:in `cached_spec'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/downloader/cache.rb:125:in `cached_pod'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/downloader/cache.rb:33:in `download_pod'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/downloader.rb:42:in `download'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/installer/pod_source_installer.rb:121:in `download_source'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/installer/pod_source_installer.rb:60:in `install!'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/installer.rb:374:in `install_source_of_pod'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/installer.rb:339:in `block (2 levels) in install_pod_sources'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/user_interface.rb:85:in `titled_section'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/installer.rb:338:in `block in install_pod_sources'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/installer.rb:321:in `each'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/installer.rb:321:in `install_pod_sources'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/installer.rb:164:in `block in download_dependencies'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/installer.rb:162:in `download_dependencies'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/installer.rb:117:in `install!'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/command/install.rb:41:in `run'
/Library/Ruby/Gems/2.3.0/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:22:in `load'
/usr/local/bin/pod:22:in `<main>'
Would like to point out that you can make your Podfile compatible with the latest Cocoapods by making a few simple modifications:
The Podfile would look like the following:
installer.target_installation_results[0].each do |installationResultArray|
targetName = installationResultArray[0];
target = installationResultArray[1]
if targetName == 'ExpoKit'
target.native_target.build_configurations.each do |config|
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)']
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'EX_DETACHED=1'
# needed for GoogleMaps 2.x
config.build_settings['FRAMEWORK_SEARCH_PATHS'] ||= []
config.build_settings['FRAMEWORK_SEARCH_PATHS'] << '${PODS_ROOT}/GoogleMaps/Base/Frameworks'
config.build_settings['FRAMEWORK_SEARCH_PATHS'] << '${PODS_ROOT}/GoogleMaps/Maps/Frameworks'
end
end
end
instead of using the pod_targets
function which doesn't return a target with a native_target anymore.
Upgrading to the latest expo version (v33.0.0, react native v0.59.8) allowed me to use the latest version of CocoaPods.
🎉 😂
Note this won't work on Cocoapods 1.6 and later.
How I fixed the issue
I was able to fix the issue by downgrading to CocoaPods version 1.5.3
Fixed the issue! Thanks
Most helpful comment
Downgrade instructions:
sudo gem uninstall cocoapods
Y
when it asks whether to remove executablessudo gem install cocoapods -v 1.5.3