react-native icon indicating copy to clipboard operation
react-native copied to clipboard

FBReactNativeSpec/FBReactNativeSpec.h: No such file or directory (in target 'React-Codegen' from project 'Pods')

Open nvacheishvili opened this issue 1 year ago • 22 comments

Description

I have upgraded to latest react native and I am able to build everything fine locally, while CI keeps throwing this error on build:

FBReactNativeSpec/FBReactNativeSpec.h: No such file or directory (in target 'React-Codegen' from project 'Pods')

** ARCHIVE FAILED **

The following build commands failed: Copy /Users/runner/Library/Developer/Xcode/DerivedData/MobileApp-fsljxdyguedfjldkjtihcbwatykp/Build/Intermediates.noindex/ArchiveIntermediates/MobileAppDev/BuildProductsPath/Release-iphoneos/React-Codegen/React_Codegen.framework/Headers/FBReactNativeSpec/FBReactNativeSpec.h /Users/runner/work/MobileApp/MobileApp/ios/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec.h (in target 'React-Codegen' from project 'Pods') (1 failure) ERROR [2024-05-30 20:10:15.14]: Exit status: 65

Steps to reproduce

N/A

React Native Version

0.74.1

Affected Platforms

Runtime - iOS, Build - MacOS

Areas

Codegen

Output of npx react-native info

System:
  OS: macOS 14.4.1
  CPU: (12) arm64 Apple M2 Max
  Memory: 3.58 GB / 64.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 21.7.1
    path: /opt/homebrew/bin/node
  Yarn:
    version: 3.6.4
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.5.0
    path: /opt/homebrew/bin/npm
  Watchman:
    version: 2024.01.22.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.5
      - iOS 17.5
      - macOS 14.5
      - tvOS 17.5
      - visionOS 1.2
      - watchOS 10.5
  Android SDK: Not Found
IDEs:
  Android Studio: 2023.1 AI-231.9392.1.2311.11255304
  Xcode:
    version: 15.4/15F31d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.9
    path: /usr/bin/javac
  Ruby:
    version: 2.7.6
    path: /Users/natavacheishvili/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.74.1
    wanted: ^0.74.1
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Stacktrace or Logs

N/A

Reproducer

N/A

Screenshots and Videos

No response

nvacheishvili avatar May 30 '24 20:05 nvacheishvili

:warning: Missing Reproducible Example
:information_source: We could not detect a reproducible example in your issue report. Please provide either:
  • If your bug is UI related: a Snack
  • If your bug is build/update related: use our Reproducer Template. A reproducer needs to be in a GitHub repository under your username.

github-actions[bot] avatar May 30 '24 20:05 github-actions[bot]

I got same error sometimes. Reinstall pods worked for me

steadev avatar May 31 '24 02:05 steadev

I am facing the same issue. Reinstalling Pods didn't work for me.

abhaypithadiya avatar Jun 01 '24 18:06 abhaypithadiya

Hi all @nvacheishvili @steadev and @abhaypithadiya! In 0.74 there has been a breaking change, for which React-Codegen has been renamed to ReactCodegen to avoid the dance for which static libraries are ok with React-Codegen as a name and frameworks needs React_Codegen (notice the - versus the _).

We also changed a little how we run cocoapods, as Codegen now always runs in both architectures.

The error you linked above, which I paste below, means that your app can't find the FBReactNativeSpec.h file.

FBReactNativeSpec/FBReactNativeSpec.h: No such file or directory (in target 'React-Codegen' from project 'Pods')

** ARCHIVE FAILED **

The following build commands failed:
Copy /Users/runner/Library/Developer/Xcode/DerivedData/MobileApp-fsljxdyguedfjldkjtihcbwatykp/Build/Intermediates.noindex/ArchiveIntermediates/MobileAppDev/BuildProductsPath/Release-iphoneos/React-Codegen/React_Codegen.framework/Headers/FBReactNativeSpec/FBReactNativeSpec.h /Users/runner/work/MobileApp/MobileApp/ios/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec.h (in target 'React-Codegen' from project 'Pods')
(1 failure)
ERROR [2024-05-30 20:10:15.14]: Exit status: 65

So, some questions to let you unblock yourselves:

  1. From which library the error come from?
  2. Are you building with the New Architecture or the Old Architecture?
  3. You mentioned that you have the error in CI: are you using a cache, perhaps? Can you try to invalidate it?
  4. Can you create a repro using this template

I just tried to archive a new app created with 0.74 and the archive step worked fine.

cipolleschi avatar Jun 03 '24 09:06 cipolleschi

Hey everyone, I resolved this issue in the following way.

I setup the CI with yarn 3.0 (not sure if it did actually have an impact though)

made sure that the runner was on macos-14 building with Xcode 15.4 and ruby 2.7.6

Installed latest cocoapods & updated gemfile in ios using bundle update

Invalidated caches using this script before building:

#!/bin/bash
# Ripped from: https://gist.githubusercontent.com/townofdon/087c7c0bb773adb158f20339c7e13408/raw/53ccb3430cf870c3cdeecead82bc12c3644f2f53/react-native-nuke.sh
# ReactNative script to clean all the things
# usage:
# - add each item below as a separate script in package.json
# - add one final script:
#   - "clean": "yarn clean-node-modules && yarn clean-pods && yarn clean-ios && yarn clean-android && yarn clean-rn-cache"
# - alternatively, copy this shell script and add the following cmd to package.json:
#   - "clean": "./react-native-clean-sh"
#   - you may need to run `sudo chmod 777 ./react-native-clean-sh before this script can run`

echo "                              ____                      "
echo "                      __,-~~/~    \`---.                 "
echo "                    _/_,---(      ,    )                "
echo "                __ /        <    /   )  \___            "
echo "               ====------------------===;;;==           "
echo "                   \/  ~\"~\"~\"~\"~\"~\~\"~)~\",1/            "
echo "                   (_ (   \  (     >    \)              "
echo "                    \_( _ <         >_>'                "
echo "                       ~ \`-i' ::>|--\"                   "
echo "                           I;|.|.|                      "
echo "                          <|i::|i|>                     "
echo "                           |[::|.|                      "
echo "                            ||: |                       "
echo "______________________REACT NATIVE CLEAN ALL________________ "

# clean-node-modules
echo "____________________________________________________________"
echo "About to clean node_modules"
rm -rf node_modules
echo "Done cleaning node_modules"
echo "____________________________________________________________"
# clean-pods
echo "____________________________________________________________"
echo "About to clean pods and reinstall them"
cd ios && rm -rf Pods && cd ..
echo "Done cleaning pods"
echo "____________________________________________________________"
#reinstall node_modules
echo "____________________________________________________________"
echo "About to install node_modules"
npm install --legacy-peer-deps
echo "Done installing node_modules"
echo "____________________________________________________________"
# clean-ios
echo "____________________________________________________________"
echo "About to clean the builds for iOS"
rm -rf ios/build && rm -rf ~/Library/Developer/Xcode/DerivedData && rm -rf ./ios/DerivedData
echo "Done cleaning builds for iOS"
echo "____________________________________________________________"
#reinstall pods
echo "____________________________________________________________"
echo "About to install pods"
cd ios && pod deintegrate && pod install && pod install --repo-update && cd ..
echo "Done installing pods"
echo "____________________________________________________________"
# clean-rn-cache
echo "____________________________________________________________"
echo "About to clean rn cache"
rm -rf $TMPDIR/react-* && rm -rf $TMPDIR/react-native-packager-cache-* && rm -rf $TMPDIR/metro-bundler-cache-*
echo "Done cleaning rn cache"
echo "____________________________________________________________"

nvacheishvili avatar Jun 04 '24 14:06 nvacheishvili

Hey Guys! I am new to App Development so I don't have much knowledge about this.

I installed the latest version using npx react-native@latest init AwesomeProject. Later it asked me if i want to install cocopods to which I responded yes. I am using 1.15.2 version.

After everything was installed. I did npx react-native run-ios in the project directory.

And I got the below error.

Command PhaseScriptExecution failed with a nonzero exit code

warning: Run script build phase '[CP-User] [Hermes] Replace Hermes for the right configuration, if needed' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'hermes-engine' from project 'Pods')
warning: Run script build phase 'Bundle React Native code and images' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'AwesomeProject' from project 'AwesomeProject')
warning: Run script build phase '[CP-User] [RN]Check rncore' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'React-Fabric' from project 'Pods')

--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:iOS Simulator, id:77BDA196-C250-483C-BD03-8BBAF144CB78, OS:17.4, name:iPhone SE (3rd generation) }
{ platform:iOS Simulator, id:77BDA196-C250-483C-BD03-8BBAF144CB78, OS:17.4, name:iPhone SE (3rd generation) }
** BUILD FAILED **


The following build commands failed:
	PhaseScriptExecution [CP-User]\ Generate\ Specs /.../AwesomeProject-frwntmzqjfbbtpebzntqavmomgxa/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-Codegen.build/Script-46EB2E00012AD0.sh (in target 'React-Codegen' from project 'Pods')
(1 failure)

My Ruby Version is ruby 2.6.10p210 and node Version is v22.1.0

abhaypithadiya avatar Jun 06 '24 18:06 abhaypithadiya

@abhaypithadiya sorry for the late reply. Have you solved the issue? The problem could be that your node is properly setup.

  1. Can you check the content of your .xcode.env.local file?
  2. can you run command -v node?
  3. Does the two match?

cipolleschi avatar Jun 24 '24 12:06 cipolleschi

Hey @cipolleschi! I couldn't solve the issue yet. The content in .xcode.env.local is same as the output which comes when i run command -v node. Both of them match.

abhaypithadiya avatar Jun 24 '24 12:06 abhaypithadiya

I'm also getting this issue with a clean installation and new project. I have no idea how to resolve it!

papaytl185 avatar Jun 26 '24 13:06 papaytl185

@abhaypithadiya - I resolved my issue, it ended up being I had the project in a parent folder with a space "Expo Test", changed to "ExpoTest" and everything built!

papaytl185 avatar Jun 26 '24 15:06 papaytl185

Hey @papaytl185! Thankyou for your reply! But I am not using Expo, and I just copy pasted the code from the documentation so it is just AwesomeProject. So there is no space and it is in the root level not inside any folders.

abhaypithadiya avatar Jun 26 '24 15:06 abhaypithadiya

@cipolleschi I run into this issue when building using static frameworks.

From which library the error come from? React-Codegen

Are you building with the New Architecture or the Old Architecture? New Architecture

I am using RN 0.74.2 - is it expected that ReactCodegen should be installed instead of React-Codegen on this version? Because for me it is always React-Codegen

Hope this helps, thanks!

LydGol90 avatar Jun 27 '24 11:06 LydGol90

I am using RN 0.74.2 - is it expected that ReactCodegen should be installed instead of React-Codegen on this version? Because for me it is always React-Codegen

Yeah, you are right. I mixed up versions. We moved from React-Codegen to ReactCodegen in 0.75, not 0.74. I misremembered when I replied above.


I'm trying to repro the issue:

npx [email protected] init RN0742 --version 0.74.2 --skip-install
cd RN0742
yarn
cd ios
bundle install
USE_FRAMEWORKS=static RCT_NEW_ARCH_ENABLED=1 bundle exec pod install
cd ..
yarn ios

It builds and run for me.

Screenshot 2024-06-27 at 14 32 45

There should be some other library that is making it fail.

Can you provide a reproducer using this template, please?

cipolleschi avatar Jun 27 '24 12:06 cipolleschi

Hello @cipolleschi! i tried making a reproducer, please check it out: https://github.com/abhaypithadiya/react-native-test. I get the yarn error but i am not using yarn. When I try to build the ios app I still get this error:

 PhaseScriptExecution [CP-User]\ Generate\ Specs /Users/.../Xcode/DerivedData/AwesomeProject-exerqpxetpbwwdampafvvsyirlxo/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-Codegen.build/Script-46EB2E00012AD0.sh (in target 'React-Codegen' from project 'Pods')

Hope this helps!

abhaypithadiya avatar Jun 28 '24 09:06 abhaypithadiya

@abhaypithadiya what's the content of your .xcode.env.local? Also, what happen if you build from Xcode instead of with CLI?

cipolleschi avatar Jun 28 '24 13:06 cipolleschi

The content of .xcode.env.local is: export NODE_BINARY=/opt/homebrew/bin/node.

If I build from Xcode I get the same error.

@cipolleschi

abhaypithadiya avatar Jun 28 '24 13:06 abhaypithadiya

I am facing the same issue. I am also on Rn version 0.74 with xcode 15.3.

chahinramonaghrim avatar Jul 01 '24 09:07 chahinramonaghrim

When building the app using fastlane I get: `e script phase. (in target 'RCT-Folly' from project 'Pods') ** ARCHIVE FAILED **

The following build commands failed: Copy /Users/.../Library/Developer/Xcode/DerivedData/App-gwezcvnfaoafftbtwlztzpvcrteg/Build/Intermediates.noindex/ArchiveIntermediates/App/BuildProductsPath/Release-iphoneos/React-Codegen/React_Codegen.framework/Headers/FBReactNativeSpec/FBReactNativeSpec.h /Users/.../apps/app-app/ios/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec.h (in target 'React-Codegen' from project 'Pods') (1 failure) [11:05:50]: Exit status: 65`

chahinramonaghrim avatar Jul 01 '24 09:07 chahinramonaghrim

Hi everyone,

I was facing the same issue and spent two days thinking it was related to Xcode 15.3, React Native 0.74.3 and React-Codegen. After some investigation, I found the real problem.

If your app is in a directory that contains spaces, this error might occur. For example, my project was inside /React Native/AwesomeProject. I simply changed it to /React-Native/AwesomeProject, and the issue was resolved.

After changing the directory name, follow these steps:

  1. Restart Xcode.
  2. Clean the build folder (Product > Clean Build Folder).
  3. Build your project again.

I hope this helps save someone else time!

@abhaypithadiya see if this solution works for you.

zeelgohil avatar Jul 04 '24 09:07 zeelgohil

Hello @zeelgohil! Thankyou for you reply! I tried this approach but still get the same error.

abhaypithadiya avatar Jul 08 '24 13:07 abhaypithadiya

@cipolleschi I have upgraded the project from 0.72 to 0.74 and now the same error appears in CI. This works fine in local machine. Do you have any work around for this issue?

awadeyar1 avatar Jul 08 '24 19:07 awadeyar1

It's very hard for me to help out without a reproducer. Could you create one from this template?

Make sure that the local configurations and the configuration in CI are the same:

  • node version
  • yarn version
  • xcode version
  • ruby version
  • cocoapods version

Also, make sure that node is in the PATH

cipolleschi avatar Jul 09 '24 12:07 cipolleschi

Ciao @cipolleschi 👋 Thanks for following this topic. [Edit: local config issue: coreutils cp breaks React-Codegen. See next comment]

Unfortunately, I'm experiencing the same issue described above. It seems that React-Codegen script is failing.

I managed to reproduce it on a new project just doing:

npx react-native@latest init AwesomeProject
cd AwesomeProject
yarn
cd ios && pod install && cd ..
yarn run ios --simulator "iPhone 15"

Then I created a reproducer and I managed to reproduce the issue.

git clone [email protected]:LucaGaspa/reproducer-react-native-lg.git
cd reproducer-react-native-lg/ReproducerApp     
yarn
cd ios && pod install && cd ..
yarn run ios --simulator "iPhone 15"

My take is that the script fails due to my local configuration since you are not experiencing anything. I can share with you my config: I'm using asdf and asdf current outputs:

nodejs          20.9.0          /Users/luca.gasparetto/Documents/repos/examples/.tool-versions
python          ______          No version is set. Run "asdf <global|shell|local> python <version>"
ruby            3.2.2           /Users/luca.gasparetto/Documents/repos/examples/.tool-versions
yarn            1.22.19         /Users/luca.gasparetto/Documents/repos/examples/.tool-versions

Then

which node
/Users/luca.gasparetto/.asdf/shims/node

cat ios/.xcode.env
export NODE_BINARY=$(command -v node)

cat ios/.xcode.env.local 
export NODE_BINARY=/Users/luca.gasparetto/.asdf/shims/node

Just in case I'm adding the end of pod install log

Pod install took 20 [s] to run
Integrating client project

[!] Please close any current Xcode sessions and use `ReproducerApp.xcworkspace` for this project from now on.
Pod installation complete! There are 56 dependencies from the Podfile and 55 total pods installed.

[!] [Codegen] warn: using experimental new codegen integration

[!] hermes-engine has added 1 script phase. Please inspect before executing a build. See `https://guides.cocoapods.org/syntax/podspec.html#script_phases` for more information.

and yarn run ios log

/bin/sh -c /Users/luca.gasparetto/Library/Developer/Xcode/DerivedData/ReproducerApp-aybxlesmzweeefaijuhgmxtlpywy/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-Codegen.build/Script-46EB2E00012AB0.sh
Node found at: /Users/luca.gasparetto/.asdf/shims/node
[Codegen] Analyzing /Users/luca.gasparetto/Documents/repos/examples/reproducer-react-native-lg/ReproducerApp/package.json
[Codegen] Searching for codegen-enabled libraries in the app.
[Codegen] The "codegenConfig" field is not defined in package.json. Assuming there is nothing to generate at the app level.
[Codegen] Searching for codegen-enabled libraries in the project dependencies.
[Codegen] Found react-native


[Codegen] >>>>> Searching for codegen-enabled libraries in react-native.config.js
[Codegen] Processing FBReactNativeSpec
[Codegen] Searching for podspec in the project dependencies.
[Codegen] Processing rncore
[Codegen] Searching for podspec in the project dependencies.
[Codegen] Generating Native Code for ios
[Codegen] Generated artifacts: /Users/luca.gasparetto/Library/Developer/Xcode/DerivedData/ReproducerApp-aybxlesmzweeefaijuhgmxtlpywy/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-Codegen.build/DerivedSources/generated/source/codegen/out/build/generated/ios
[Codegen] Generating Native Code for ios
[Codegen] Generated artifacts: /Users/luca.gasparetto/Documents/repos/examples/reproducer-react-native-lg/ReproducerApp/node_modules/react-native/ReactCommon
[Codegen] Creating component provider.
[Codegen] Generated provider in: /Users/luca.gasparetto/Documents/repos/examples/reproducer-react-native-lg/ReproducerApp/node_modules/react-native/React/Fabric
[Codegen] Done.
cp: invalid option -- 'X'
Try 'cp --help' for more information.
Command PhaseScriptExecution failed with a nonzero exit code

warning: Run script build phase '[CP-User] [Hermes] Replace Hermes for the right configuration, if needed' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'hermes-engine' from project 'Pods')
warning: Run script build phase 'Bundle React Native code and images' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'ReproducerApp' from project 'ReproducerApp')
warning: Run script build phase '[CP-User] [RN]Check rncore' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'React-Fabric' from project 'Pods')

--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:iOS Simulator, id:BDC937B2-2E5E-4F54-972F-B1FECD03D8C3, OS:17.4, name:iPhone 15 }
{ platform:iOS Simulator, id:BDC937B2-2E5E-4F54-972F-B1FECD03D8C3, OS:17.4, name:iPhone 15 }
** BUILD FAILED **


The following build commands failed:
	PhaseScriptExecution [CP-User]\ Generate\ Specs /Users/luca.gasparetto/Library/Developer/Xcode/DerivedData/ReproducerApp-aybxlesmzweeefaijuhgmxtlpywy/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-Codegen.build/Script-46EB2E00012AB0.sh (in target 'React-Codegen' from project 'Pods')
(1 failure)
]

Node.js v20.9.0

Edit: XCode version 15.4 (15F31d) pod --version -> 1.14.3

Hope it helps! Feel free to reach out for further information 😊

LucaGaspa avatar Jul 16 '24 13:07 LucaGaspa

Hi again @cipolleschi 👋 I guess we can ignore my previous comment. I'm gonna leave it there for other people. Tell me if you want to delete it otherwise.

As we can see from build log I have an error on cp:

cp: invalid option -- 'X'
Try 'cp --help' for more information.

It didn't took long to figure out that something with cp is not working and when I found the related fix in RN v0.75, I run which cp:

/opt/homebrew/opt/coreutils/libexec/gnubin/cp

And 🎉 that's it I guess.

One last question: do you know by any chance if we can expect a v0.74.4 containing that patch? 🙏

LucaGaspa avatar Jul 16 '24 15:07 LucaGaspa

Hi Luca! Thanks for the due diligence and for finding the solution! :D

I created a cherry pick request: as soon as we prepare 0.74.4, it will be included!

cipolleschi avatar Jul 18 '24 12:07 cipolleschi

Possible Solutions for React Native Upgrade Issue

If you're encountering issues after upgrading React Native from version 0.72.x to 0.73.x or 0.74.x, please consider the following solutions:

Quick Solution: Remove the .xcode.env.local file located at app/ios/.xcode.env.local and attempt to run the project again. The reason for this is that the React Native upgrade helper does not include this file, which might be causing conflicts.

Additional Information: A fix for this issue is mentioned in this GitHub thread. The fix is expected to be included in React Native version 0.74.4, which should be available soon.

I hope these steps help resolve the issue.

MAsadIlyasNajum avatar Jul 23 '24 10:07 MAsadIlyasNajum

I was facing the same issue after updating my React Native app from version 0.72 to 0.74. I have a script that handles cleaning and reinstalling React Native dependencies. The steps in the script are as follows:

  • Remove node_modules
  • Remove Pods
  • Reinstall node_modules
  • Reinstall Pods (run pod install)
  • Clean the Xcode build

Solution:

The issue was that the Xcode build clean step was being executed after running pod install. This caused the build folder to be deleted, including the files generated by React-Codegen during the pod install step, leading to the problem.

To fix this, I simply reversed the order of the steps in the script. Now, I clean the Xcode build before running pod install.

This change resolved the issue for me!

lucasoliveiracruz avatar Aug 13 '24 19:08 lucasoliveiracruz

I recently updated my project from 0.73.4 to 0.75.3 and I'm getting this error with RCTVibration.

image

I know why this error is happening, with the last version the FBReactNativeSpec.h file was inside ./node_modules/react-native/React. But for some reason, the file is gone and I couldn't find it.

Does anyone have a possible solution to my problem? Are there any missing scripts or configs on my podfile?

joaoveronezi avatar Sep 19 '24 17:09 joaoveronezi

That file is generated by codegen. try to:

  1. run bundle exec pod deintegrate from the ios folder
  2. delete node_modules
  3. run yarn in the root folder of your project
  4. run bundle exec pod install in the ios folder.

One of the steps we run during pod install is to run Codegen. That should fix.

cipolleschi avatar Sep 20 '24 08:09 cipolleschi

I've identified the issue. Thanks @cipolleschi.

I'm currently developing a CocoaPods library for iOS using React Native. I've successfully created the library, but as I'm updating the React Native version, I'm facing some additional challenges.

For those interested, I built this CocoaPods library to integrate with iOS native code using React Native. The podspec file is configured to include the bundled JS file within the assets, ensuring seamless integration. Example.podspec

  s.name             = 'ExampleSDK'
  s.version          = exampleSDK_version
  s.summary          = 'Summary'
  s.description      = 'Description'
  s.homepage         = 'github sdk-pod homepage'
  s.license          = { type: 'No License' }
  s.author           = { 'author team' => 'author team email }
  s.source           = { :git => 'git hub page', :tag => s.version.to_s } 
  # This is where I kept all the native code necessary to create the bridge between with bundled JS code
  s.source_files     = 'ExampleSDK/Classes/**/*.{h,m,swift}'
  # This is where I kept the bundled JS code
  s.resources        = 'ExampleSDK/Assets/{ExampleSDK.js,assets}'
  #Showing where is the bundled file
  s.ios.resource_bundles = { 'ExampleSDK' => ['ExampleSDK/Assets/{ExampleSDK.js,assets}'] }
  s.platform         = :ios, '13.4'

The rest of the podspec primarily contains the dependencies required to install and run the project.

Additionally, you’ll need a repository that holds all the specifications your example SDK requires, so CocoaPods can locate and install them.

When an integrator wants to use my library, they simply need to create a Podfile with the following, and run a pod install

platform :ios, '13.4'

source 'https://github.com/Example/ExampleSDK-specs.git'
source 'https://github.com/CocoaPods/Specs.git'

use_frameworks!
target 'Example Project' do
  pod 'ExampleSDK', 'version'

end

That's it. React-native code (JS) running directly with native IOS code.

joaoveronezi avatar Sep 20 '24 13:09 joaoveronezi