Run react native app on Xcode 10 - xcode

I get this error when i want to run my react native app hello world app on Xcode 10 (new beta version), can you help me?
The error :
error: Build input file cannot be found:
'/Users/nic/Documents/X-Project/xapp/node_modules/react-native/Libraries/WebSocket/libfishhook.a'
Screen shot from my Xcode

This helped me:
Remove and add again libfishhook.a from Xcode and the path issue will resolve.

This issue is caught by the stricter xcode 10 new build system.
A temporary fix while react-native really fix the issue is to switch back to using the old build system
In Xcode, Select File -> Project/Workspace Setting. You will see a Build System option to select the Legacy Build System as shown below
Clear your project and "Derived Data" Build and Run your project
BONUS Point: If you are using a CI/CD pipeline you can also add the xcodebuild argument -UseNewBuildSystem='NO' to the cli or via fastlane xcargs: "-UseNewBuildSystem='NO'"

Manually copypasting libfishhook.a into the correct folder, as suggested here, worked for me:
For a solution, I copied the file from my ios/build/Build/Products/Debug-iphonesimulator/libfishhook.a and pasted it into ../node_modules/react-native/Libraries/WebSocket/ and got the build. I hope it helps.
...

Daniel's answer helped me to solve problem. Just note that if it's tvOS, then the same action of removing and adding should be done of RCTWebSocket-tvOS.a

Related

GeneratedInfoPlistDotEnv.h file is not found

I have a issue, regarding Xcode, in react-native permission file
in which GeneratedInfoPlistDotEnv.h file is not found.
How to fix this?
Already changed Info.plist Preprocessor Prefix File to
${CONFIGURATION_BUILD_DIR}/GeneratedInfoPlistDotEnv.h
but it did not solve.
issue is:
:1:10: fatal error:
'/Users/DAMAGE/Library/Developer/Xcode/DerivedData/EmployWise-fzbhiywasjfdjnfqjsfnxjbhahzs/Build/Products/GeneratedInfoPlistDotEnv.h'
file not found
Was getting this from react-native-config cocoapod. But its been fixed in v1.4.11. Was due to the older version not writing output script variables, which XCode 14 requires
This issue comes when react native is not able to link to the configuration file like .env file created in your react native environment. If you have used any react native config framework like react-native-config. then make sure this framework is linked for your iOS environment as shown below
react-native link react-native-config
If you are using react-native version >= 0.60 then follow the below steps after linking is done.
Go to ios folder and run pod install.
Next do the following:
1. Remove Derived Data from Xcode
2. Clean Build Folder
3. Build the project again
I had this problem, my solution was to change the Xcode build system from "Legacy Build System" to "New Build System" in the Workspace Settings under the File menu
In my case, I was trying to add a new target for rn-extensions-share and forgot to add all necessary libraries for that new target.

How to fix "Print: Entry, ":CFBundleIdentifier", Does Not Exist" while running others project, what to do?

I'm trying to launch project from github and this problem occurs:
Error occurs after running via react-native run-ios
I tried to launch it on different simulators - didn't work
Reinstalling node_models - didn't work
react-native upgrade - didn't work
Here's what you need to do
go to your cd to node_modules/react-native/third-party/glog-0.. and run ./configure
If you have any working react-native project then copy node_modules/react-native/ folder and replace with current project..
I know it's not a solution but that's how I am doing it right now. I am also looking for solution. Right now, it's working for me with this.
for me switching version of XCode worked great (from 10.1 to 9.2), while none of any other methods from the web did
thank you all

Xcode 10 Command PhaseScriptExecution failed with a nonzero exit code (EXPANDED_CODE_SIGN_IDENTITY: unbound variable)

This error pops up when doing Project > Test
/Users/.../Project/Pods/Target Support Files/Pods-Target/Pods-TargetTests-frameworks.sh:
line 104: EXPANDED_CODE_SIGN_IDENTITY: unbound variable
Command PhaseScriptExecution failed with a nonzero exit code
How do I resolve "Command PhaseScriptExecution failed with a nonzero exit code" error when trying to test a project with cocoapods?
This helped me
sudo gem install cocoapods --pre
pod update
I've read BugReport. Problem was similar to mine and it was fixed in 1.6.0.beta.1 (2018-08-16) (changelog).
Updated(thanks to Cœur)
1.6.0 (2019-02-07) Was published
sudo gem update cocoapods
This should work now.
I have facing the same issue, i believe this issue have something link to keychain access too (code signing problem), I go to keychain access unlock the login then lock it again fixed this issue. After uploading toOSMojave and Xcode 10 keychain need to reverify the password. (how i find this? while facing same issue and trying all available option, i think to generate certificate again, but while generating private key i found keychain login user name and password is wrong type of message- i lock and unlock again solved my problem). Note this process required your login pass phare.
How to fix:- short tip
Go to keychain access -> right click on login -> lock & unlock again
-> clear Xcode project and make build again.
Some Framework or SDK require Code Signing.
I done code signing and resolved the similar problem for me.
EXPANDED_CODE_SIGN_IDENTITY: unbound variable
Command PhaseScriptExecution failed with a nonzero exit code
I had the same problem after updating BuildSettings and Podfile
I just restarted Xcode and opened a workspace - .xcworkspace (not project - .xcodeproj)
[Workspace vs Project]
Go to pod folder and change the file as executable file. It works for me.
chmod +x filename
filename => your file name like "swiftlint"
On the top of - Pods-yourProjectName-frameworks.sh
export EXPANDED_CODE_SIGN_IDENTITY=""
export EXPANDED_CODE_SIGN_IDENTITY_NAME=""
export EXPANDED_PROVISIONING_PROFILE=""
this is an issue with pod update.
I had the same problem and could solve it, by just renaming the project. In my case this error was, because I had a ' symbol in my project name.
Delete the Pods directory and the Podfile.lock file.
Run pod install to re-create them from scratch.
Clean the Xcode project.
Build the Xcode project.
Well, a simplepod install worked for me :)
I've had the same problem. It turns out that by switching between Xcode9 and Xcode10 sometimes it can happen that the command line tools used for building can be switched so I was trying to build it with 9.4 command line tool instead of 10 which caused the issue.
Going to preferences and setting the command line tool to the right one fixed the issue for me.
Another thing that helped me is to disable and enable iCloud again. (Not sure why.)
Ive been dealing with this issue for a couple of days now. What did it for me was.
-Update cocoapods to the last version
-Update all pods
-Opening keychain access and delete the key made by xcode (with xcode closed)
-Opening Xcode will recreate a new key and will ask you for the password.
-After this I cleaned and built and the application ran on my physical device.
I hope this is helpful since its a very annoying bug.!
Restarting the mac helped me,not the xcode.
Check the issue clearly, if it is related to swiftlint.yml then this hidden file must be present in your directory. If you are working on more than one module then you can copy and paste it from your other modules if any.
If you're on an M1/Apple Silicon Mac, make sure you have your Excluded Architectures set up properly. I don't know why this is necessary, but here's how you do it:
Go to Build Settings
Make sure you view "All" (default is "Basic")
Expand "Excluded Architectures"
Under debug, select Any iOS Simulator SDK, and add a value for "arm64"
Do the above settings for each relevant target, in my case I have "Pods", "Project", and then the iOS target.
nvm alias default 16.6.0 if you want it pegged to that specific version.
You can also do nvm alias default 16.
In My case, I tried many solutions but all in vain
Solution: I just do "Pod deintegrate" and then "pod install" then my project is working perfectly.

'hello/Hello.h' file not found - Trying to build/run iOS gomobile Hello app

I am building the gomobile Hello example app, but am running into the following problem: When trying to build and run the app after opening it in Xcode (7.1), I get the error 'hello/Hello.h' file not found'
From what I can tell, Hello.h is in fact in the hello folder of the native directory.
Following this discussion on Github, it seems like this is due to a recent change in the way Xcode 7 updates paths for the headers.
The proposed solution is to check Copy items if needed when importing the framework:
I can confirm that this fixes the issue. But note that you would then need to re-import the framework every time you make changes and build the go code.

Fixing file 'project.pch' has been modified since the precompiled header was built error in Xcode

I was recently working on my application messing around in the info.plist section, and since that my application will not run on my test device:
file 'project.pch' has been modified since the precompiled header was built
Something to note is that the app runs fine in the simulator.
Edit: Now I am getting this error instead of the other one:
No such file or directory (/Users/Me/Library/Developer/Xcode/DerivedData/MyProject-abcdefghijklmnopqrstuvwxyz/Build/Products/Debug-iphoneos/MyApp./MyApp)
How to regenerate the info.plist file?
You could try a deep clean (not the same as Product > Clean) - Option+Command+Shift+K
Note: this means the clean the build folder (by pressing Option + Product -> clean folder)
Close your project or workspace.
In Finder: ⇧shift+⌘cmd+G
Paste: ~/Library/Developer/Xcode/DerivedData/
Delete the ModuleCache folder and empty trash.
Open up your project.
Clean: ⇧shift+⌘cmd+K
Build: ⌘cmd+B
In my case the error message had a small hint:
note: after modifying system headers, please delete the module cache
at
'~/Library/Developer/Xcode/DerivedData/ModuleCache/5CYAJ91AZCB7'
I tried and it worked.
Simply touching the project's pch file solved this issue it for me :
touch Test.pch
Product -> Clean
Product + Option -> Clean Build Folder
Close Project or Workspace
Clean 'ModuleCache' path in Finder.
Worked for me in Xcode6 GM and iOS 8.0.
When the .h file of a Library Provided with Xcode is changed (even a space), this error could occur.
The following maybe tried in order to fix this issue
In, Project -> Build Settings, change Precompile Prefix Header to NO
OR
Run rm -rf ~/Library/Developer/Xcode/DerivedData and Clean Build
I constantly had this since upgrading from Xcode 4.6 to Xcode 5 with iOS projects when using command line build (xcodebuild).
What worked for me is to use this as command line build command:
xcodebuild -project path/to/my.xcodeproj -configuration Debug clean build
Before this, I've tried:
Clean the project in Xcode GUI.
Delete the offending pch file.
Delete the offending pch file's parent folder.
Delete the DerivedData project folder.
None of the above worked for me under Xcode 5.0.2, Mavericks, iOS7.
Note that the problem didn't happen to me when using Xcode GUI.
I just go to directory "/$HOME/Library/Developer/Xcode/DerivedData/", delete everything there
Just Click Product from the menu and select Clean
Product>Clean
Worked fine for me.
I got the same problem. My error said like I need to delete the cache in the below locaition,
Users/myusername/Library/Developer/Xcode/DerivedData/ModuleCache/3FGETKFCU0N0W
3FGETKFCU0N0W was a folder, when I deleted it and then clean build the project. Then the error disappears.
rm -rf ~/Library/Developer/Xcode/DerivedData/
If you use AppCode you can try remove content form:
/Users/[Username]/Library/Caches/appCode30/DerivedData/
Worked for me :)
Also, just open terminal, and delete the .pcm file that has been generated (Xcode 6 onwards)
rm <path-to-pcm-file>
If you get this when switching between git branches, try adding this post-checkout hook which will clean your project every time you change branch.
!/bin/sh
xcodebuild clean -configuration Debug
Save as .git/hooks/post-checkout relative to your project root and don't forget chmod +x .git/hooks/post-checkout
For me, this problem is only occurring in Xcode 6 beta version, So I switch back to Xcode 5, and now problem is solved.
I tried all the steps suggested by all users here, but no one worked for me.
So, if you have both versions of Xcode and have issue only in Xcode 6 beta, then switch to Xcode 5 and clean the project, problem will be solved.
I tried these one by one but failed to build and run my project. So I changed Precompile Prefix Header to NO as mentioned by #Abhilash Gopal, then I reset the simulator,deleted the derived data, removed the corresponding .pcm file(In my case it was the UIImage.h from UIKit framework, so removed the UIKit.pcm).Then I cleaned the project and only then I was able to build it successfully. In earlier versions of Xcode these files were locked basically and were not allowed to edit. But its not the case now. Hope this helps someone who face the same situation.
The only solution there worked for me was running the following command:
sudo rm -R /var/folders/
But that gave me a lot of troubles in OS X.
I thought because /var/folders/ is for temporary files it should be okay to just empty anything in it.
But I was wrong see the following post: link
And the problem you described occurred every-time I tried to build my Xcode project - I'm building it from the CLI though Jenkins.
Which means I couldn't run the rm command every-time. So I found some inspirations and wrote the following ruby script which solved my problem:
#!/usr/bin/env ruby
require 'fileutils'
cache = Dir.glob("/var/folders/**/com.apple.DeveloperTools*")
FileUtils.rm_rf(cache)
I hope it would be helpful to someone.
Deleting project.xcworkspace did a trick for me.
project.xcworkspace is a directory which describes schema of current Xcode workspace state. Each time Xcode is launched it will regenerate project.xcworkspace if not exist already.
In order to delete project.xcworkspace:
Right click on your project file yourProject.xcodeproj
From drop-down menu choose Show Package Content
Purge xcworkspace file
If you are building on command line using xcodebuild remove '-parallelizeTargets' option passed to the command. That fixed the issue for me
After going through a lot of answers and helpful suggestions, I found out the solution to be: Uninstall Xcode 6 and reinstall it through the available dmg file and then install all the components for Xcode.
Product + Option -> Clean Build Folder, Clean Build Project, Deleting Module Cache files and Derived data files, using touch .pch, deleting pcm file, using command line to remove var/folders (Surprisingly, all of this did not help in my case)
Was stuck at it for more than 3 hours before finding the solution. Hope this helps someone.
Thanks.
Just open terminal and fire below command:
rm /Users/pratik/Library/Developer/Xcode/DerivedData/ModuleCache/LKL48GNAN6S7/UIKit-2X95M2Q1NPNPL.pcm
give your file path which return .pcm error. and then Clean Project and Run...Enjoy!!!

Resources