Moving React Native project to new folder - react-native

i need to move RN project to new folder, but when i do that. I get this error when i run the project using react-native run-ios. When running the project from original folder, there are no errors.
error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening TestProject.xcworkspace
The following commands produced analyzer issues:
Analyze /Users/home/Desktop/APLIKACE/TestProject/node_modules/react-native/ReactCommon/jsi/jsi.cpp normal x86_64
Analyze /Users/home/Desktop/APLIKACE/TestProject/node_modules/react-native/ReactCommon/yoga/yoga/Yoga.cpp normal x86_64
(2 commands with analyzer issues)
The following build commands failed:
CompileC /Users/home/Desktop/APLIKACE/TestProject/ios/build/TestProject/Build/Intermediates.noindex/React.build/Debug-iphonesimulator/React.build/Objects-normal/x86_64/RCTUIUtils.o /Users/home/Desktop/APLIKACE/TestProject/node_modules/react-native/React/UIUtils/RCTUIUtils.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

So i figured out a solution, which is working for what i need to do ( move project to new empty folder where i initialized github repo ).
So it seems there are some issues with relative paths and names. So what i did was rename my old project like this
.../ParentFolder/MyProject to .../ParentFolder/MyProject2
i created new folder in ParentFolder with exactly same name as the original folder ie .../ParentFolder/MyProject. This was now empty folder i initialized as Git repo.
Then i copied contents of MyProject2 to MyProject folder. Everything is working now fine.
Hope that helps someone in the future.

Related

React Native build failed - (in target 'RCT-Folly' from project 'Pods')

I am using Mac M1, trying to run React Native on IOS Simulator and I got this error:
CompileC /Users/jack/Library/Developer/Xcode/DerivedData/sample-gnrhtdrpdsucuifckqcsppcsfdbn/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RCT-Folly.build/Objects-normal/arm64/SysUio.o /Users/jack/React\ Native/sample/ios/Pods/RCT-Folly/folly/portability/SysUio.cpp normal arm64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'RCT-Folly' from project 'Pods')
Any solution to solve this?
I had the same issue.
What I did is, check the project folder path and then realised space contain in one folder.
solution (1). remove the space and re open the project and run.
solution (2). create new project without spaces in folder path.
Blockquote
Ex: User/My Project/ABC need to change into User/MyProject/ABC
My recommendation is solution 2
https://github.com/facebook/folly/issues/1670
This link had the solution for me, ensure that your project path doesn't have any spaces within it. I have an M1 Pro and it worked.

How to build a Framework before the App gets build in one step with the latest Xcode?

i have a project folder with a src and a example subfolder. In src lives a Framework.xcodeproj file, which needs to be build before the App.xcodeproj gets build.
Is there a way to tell Xcode to first build the Framework and after that, build the App? I tried to drag n drop the Framework.xcodeproj into the App.xcodeproj and add it to the Target Dependencies but this is not really working. I run into error messages and missing files.
Is a shellscript within a Run Script Phase a better way to do it?

Linker command failed with exit code 1 - duplicate symbol __TMRbBp

Since I've updated to Xcode 8.1 I can't archive and also not run in Release mode (in debug mode its working). The error is that there are several "duplicate symbols for architecture arm64" and all are "duplicate symbol __TMRbBp". Whats that?
It seems to be a bug in Swift. See
discussion on Apple developers portal
It is said to be fixed in Xcode version that is about to be released.
But for now there is temporary workaround:
Go to your target Build Settings and set Reflection Metadata Level flag to None
Don't double click Project.xcodeproj to start your xcode project. Instead, close your project and open the xcworkspace.
File -> Close Workspace
File -> Open -> Search your project folder for Project.xcworkspace
All my errors are gone.
I faced the same problem with archiving on Xcode 8.1.
X Code Version: Version 8.2.1 (8C1002)
The following fix worked on Mar 2019
1) Go to Project & Select your Project
2) Select Build Settings -
Search for "Enable Bitcode" Set option as "NO"
3) Most of version will fix this issue, for few other XCode version try this option also,
Search for "Reflection Metadata Level" Set option as "NONE"
I had similar issues with Version 9.2 (9C40b), the solution is
0) Close Xcode
1) Open project folder in terminal
2) pod update
3) open .
4) open project by clicking Project.xcworkspace
Surprisingly, in some occasions, simply cleaning the product worked for me.
Product/Clean (Shift+Cmd+K)
Product/Clean Build Folder (Alt+Shift+Cmd+K)
Quick fix to try before looking at other solutions.
1.Close your project:Completely quit Xcode.
2.Go to your project location:there you will find two files in you root folder with varying extensions:
Appname.xcodeproj and Appname.xcworkspace
Now open your project by Double clicking on file with the extensions xcworkspace.(***Appname.xcworkspace*)**
Yourproject will open in xcode.
Now run your project again.
If you pay close attention when installing your pods,firebase makes it clear to open your project with your-project.xcworkspace after installing pods
firebaseIOS Setup
$ cd your-project directory
$ pod init
Add to Podfile
pod 'Firebase/Core'
And finally:
$ pod install
$ open your-project.xcworkspace
Dont forget to add firebase to your AppDelegate
If you're using Ionic and the Push and Console plugins that's the problem. Remove the cordova console plugin (which is deprecated) and the error will disappear.
The linker error is saying that a library is duplicated which is, in fact, true because the console plugin is already in cordova-ios 4.5+
It took me a couple of hours to figure this out!
In my case
Select your project (In my case i have 2 targets)
Go to Build Phases
Compile Sources
Check if the number of items on each targets is the same (mine was different)
Add the missing file / Remove the duplicated file
Problem Solved
I ran into this problem recently creating a new project and adding some pods (AlamoFire specifically) to the project. Troubled with it a couple hours or so recreating the project (it was new) several times. Tried all the methods here and no luck.
Eventually I figured out that it was because XCode V10.1 was also opening the old project file along with the new pod-created workspace when I opened the workspace via command line "open myProject.xcworkspace" when I reopened the project after doing "pod install"
Closing all projects before exiting XCode before I did my "pod install" fixed everything for me.
close you project then open xcode go to file -> open search your project and open it . this worked for me
I got this error due to deletion of some files. For me simply cloning my project worked.
For those that can't get the Thorax's answer to work, what I did was I closed out Xcode, ran pod update on my command line and then reopened the .xcworkspace file. After doing that, I was able to build and run the project.
I am using the Firebase Cocoapod and Xcode version 9.1.
I had removed files from Compile Sources in Build Phases in Targets. I added main.m and it worked.
Had the same problem in Xcode 10.1 and was able to resolve it. In path Project Target > Build Setting > No Common Blocks, I changed it to No.
I had similar kind of problem when I added a framework to my project.
I have resolved the issue by removing the framework and again adding the framework to the project by dragging and dropping the framework file to the projects frameworks folder and selecting the Copy items if needed option.

iOS giving cookie.mom error when building MFP project

We have a worklight project version 6.2.0.1 and I have migrated it to MFP 7.
During my build (Ant or eclipse) I'm getting this error for iOS:
ANT:
builtin-copyPlist --convert binary1 --outdir /Users/Sam/Desktop/ProjectName/temp/source/ProjectName/apps/ProjectName/iphone/native/CordovaLib/build/ProjectName.app -- WorklightSDK/resources/Cookies.mom
[exec]
/Users/Sam/Desktop/ProjectName/temp/source/ProjectName/apps/ProjectName/iphone/native/WorklightSDK/resources/Cookies.mom:0:
error: reading data: The file “Cookies.mom” couldn’t be opened because there is no such file.
If I built the project through eclipse and ran it to xCode i get:
Inside WoklightSDK, I don't see the cookies.mom
How to fix this error?
The mentioned files in the screen shots no longer exist in a MFP project (so it is OK that they are not there in a fresh project) The migration process was supposed to remove them and so the build should not have errored on them.
But you're getting an error, this means to me that the project was not migrated to MFP 7.
Edit: per the test project in the PMR you've opened, this is happening because in your project you use using the nativeResources folder. Use of this folder is no longer considered a best practice you should stop using it.
The error here is that After the migration process, that part of it removes the old cookies.mom files, the builder takes the contents of the nativeResources folder and copies it to the native folder. In this process it replaces the updated .xcodeproj (now with removed references to the cookies.mom files that no longer exist), with your old .xcodeproj file that does contain these references - to files that do not exist... thus when building in Xcode, it fails because it has references to files that do not exist.
Delete the .xcodeproj file from your nativeResources folder and re-building. Next, in Xcode, re-references your custom class files. After the build succeeds in Xcode and your app is working, copy back the updated .xcodeproj file to the nativeResource folder, if you choose to continue using it.
By continuing to use this folder, you void your support - as I mentioned, this folder is no longer considered a best practices and may disappear in the future.

Unable to locate libMailCore2-ios.a framework file when building MailCore2

I forked the Mailcore2 repo here: https://github.com/MailCore/mailcore2/
and tried to build the libMailcore2-ios.a framework myself.
Clone the repo
Open up the mailcore2.xcodeproj file in build-mac
Select the mailcore ios target and try building with cmd+b
The build succeeds
However, I'm unable to find where this project file exports the libMailcore2-ios.a file. I see the linked products in the project, but they are all red.
Any help?