How to build a working existing react native app on iOS? - ios

So I have an app that I have been working on for a far few months now. I developed it on Ubuntu and tested on my android phone and tablet. The app is setup using the basic react native library and I also added in expo later on for some little thing expo had that I needed. Let me know if you need more information about this.
The app is 'feature complete' and just needs to be play tested and released. So naturally I need to get it up and running on iOS. I am currently renting a mac that I can remote into (as I own no apple products).
It has been nearly a week now and I just cannot move past this error (see bottom) (or variations of what seem to be the same/similar errors). I can build a fresh app on this mac so everything is there to build react native apps. I have tried: Deleting pod and and running
pod install
running
pod deintegrate && pod install
deleting node modules and running
npm install
Initially I had an error complaining that some libraries were manually linked and this was bad so I unlinked them and now I get this error. I am opening that app using the workspace file when I run in xcode. I also get the error if running through command line i.e.
npx react-native run-ios
Using different simulators makes no difference...not sure if it is even getting that far in the build process for that to matter. I think this has something to do with the linking of RN libraries and this new auto link thing. Any thoughts? There are loads of posts with this error (or close to) that have all sorts of 'solutions', but none seem to make a difference. Overwhelmingly peoples solve this by pod install after deleting pod folder or running the pod deintegrate command. Looking at the error you can see that it prints out loads of libraries some of which I installed and others probably come with my 3rd party libraries, but some look like the core libraries and even low level looking ones that presumably RN is built on (but I honestly wouldn't know).
I was having issues before 'compiling' stuff and again I think it was to do with the linking.
Also, is there a 'react native' support service or something i.e. I pay some who knows apple and will just fix the damn thing for me
ERROR (scroll to the bottom for what is probably the important bit):
https://pastebin.com/HMdP4x3P
[EDIT]
I think this has something to do with my podfile: https://pastebin.com/5J7BbG2Q other pod files do not look like mine.

Related

'FBSDKShareKit/FBSDKShareKit.h' file not found

I've made an IOS build on Unity for an App we're making after adding the facebook SDK, moved the build on a hard drive and tried to build it on xcode on the mac we have at the office, as I always do before uploading it to the app store. I ran into this error and I've been stuck on this issue for 2 full work days and it's driving me a bit crazy, here are the thing's I've tried:
-Install cocoapods, both on the default terminal directory and on the project's directory (I'm not too experienced with cocoapods so I don't know if that made a difference. I also did pod update while standing on the project directory).
-I saw that the IOS resolver has an option called "generate pod files" that people said needed to be checked when building to solve this issue. It was checked by default on my project, so that wasn't it.
-Added the framework path on the build settings to where the facebook SDK is at (though the way it looked on my xcode seemed a bit different than the way I've seen it on other people's xcode screenshots)
-Tried commenting out some #include lines on the headers that are generating the issue. It only produced more errors.
-People said to open the project from the workspace instead of the xcodeproject but unity doesn't seem to generate a workspace file.
-Tried downgrading the Facebook SDK to a previous version but the versions people claim are working don't seem to be on the repository anymore, so it doesn't let me downgrade to them.
At the moment I'm trying to make it work with the latest Facebook SDK which is 9.0.0.
Any help would be appreciated, please let me know if I'm not being specific enough about the issue or if there's any information about my project I should include on the post
The .xcworkspace should be created by Cocoapods, not by Unity directly.
If you already have the Podfile generated, just run pod install on the project directory and open the created .xcworkspace file after Cocoapods finishes installing the external dependencies.

Exact steps needed to migrate a react native android app to iOS

I've written a react-native app and compiled it for android.
Now I wish to compile my app for iOS.
I've searched the internet and found a lot of documentation about adding react-native components to an existing iOS app project, but couldn't find a concrete guide/explanation on how to take an existing react-native project(with many components, packages installed etc) and add the relevant iOS configuration.
I guess that I somehow should create an iOS project through xCode,then probably copy some project files into my ios folder of my project, create a podfile corresponding to my packages in package.json, install the required stuff using pod install and then maybe I can run it using the react-native run-ios command, but I'm really not sure whether I'm correct and to do these steps.
If someone can clarify to me what are the required steps I'll be grateful! (And I think other people might find it useful as well)

Duplicate Symbol Problem With React Native

So I've been facing a really weird problem with React Native.
I installed a library via Cocoapods for picking images from the camera roll/photo Library and cropping the image as well, it is a silver bullet for this kind of usage. But then, it installs alongside React Native version 11, but this version of React Native was not what I wanted so I had to install React Native via Cocoapods as well so I can have the React Native version I'm using.
Now all installed well and if I try to build in my Dev environment everything works fine but when I try to archive, I get the error for duplicate symbols for WebSocket, Image (the library requires you to add RCTImage as a subspec in Cocoapods for React Native), RCTText, etc. basically all the subspecs you're required to add if installing React Native via Cocoapods according to the React Native docs.
So I figured I'll need to remove the manually linked libraries from my project, so I did that, but that only resulted in me now having another error when building for dev saying WebSocket, Linking, Network, etc are missing. Basically all the subspecs you're adding via Cocoapods, so I don't understand, if I install React Native and all its subspecs via Cocoapods (I'm also running in the workspace) shouldn't my project use the installed pods and not the linked libraries?
I've been on this for like 3 weeks now.
Here is my pods list.
Here is my linked binaries list.
Please, what do I do? I've been stuck for 3 weeks now, have tried almost any solution online but nothing has changed.
Thanks in advance.
I have solved the problem, only thing is I think you should use this carefully because I don't fully understand what it does. So within the docs, there is this Cocoapods code snippet that when you add to the Pods file after your target ends resolves this problem. Here is the code snippet.
# very important to have, unless you removed React dependencies for Libraries
# and you rely on Cocoapods to manage it
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == "React"
target.remove_from_project
end
end
end
If you know exactly what this does please post another answer with this code snippet and an explanation so I can make the answer to the question, or better yet, edit the answer with the explanation, or leave a comment below so I can update my answer. From the looks of the above code snippet, though I'd say this is removing React and it's Subspecs from the installed pods, right after installation, I might be wrong.
Now when you're done with the installation, you'll get another error when you try to build saying react-native or React could not be resolved because it is in multiple locations and that you should delete one of them, to resolve this new error, simply go to the Pods directory and delete the React folder, that is [project-root]/ios/Pods/React once you do this, your application will build for development and also archive for production.
This problem I faced stands as a result of not properly reading installation guides, there may be small discrepancies between how it's usually done and how it's done for the library you're installing, so try and give a little more attention to detail.
For me,
delete all Link Binary With Libraries (From Build Phase)
delete Podfile.lock
run pod install
Wait for Indexing In Xcode
command+shift+k (Clear the project)
build again and fix it.

Error message - RNFirebase core module was not found natively on iOS

React Native Firebase won’t install on iOS React Native project. It works fine on Android.
I followed this instruction.
https://rnfirebase.io/docs/v5.x.x/installation/initial-setup
I set up Firebase, added the downloaded plist file via XCode, installed and set up Cocoapod.
The moment I add the following line to my App.js, the simulator returns an error message.
import firebase from 'react-native-firebase';
The error message: “RNFirebase core module was not found natively on iOS”
I’ve tried a few things I picked up from this forum:
https://github.com/invertase/react-native-firebase/issues/614
I commented out following lines from Podfile
use_frameworks!
And then pod install, pod update
on Xcode, checked the Build Phases/ Link Binary with Libraries section. I checked libRNFirebase.a was already there.
I've been trying this for a few months now on and off. And I haven't found a way to make React Native Firebase install on iOS project. Any pointer would be much appreciated.
I'm currently maintaining the react-native-firebase v5 branch (current stable) and we do have a problem with the header search paths right now for some reason.
I don't have a definitive fix, but I constructed a demo that goes from react-native init, then installs react-native-firebase, and does all the things necessary such that the project builds and runs on iOS and even archives in release mode.
You may see it here: https://github.com/mikehardy/rnfbdemo
The only thing that is important at the moment is that you need to put one non-documented thing in your Podfile after following all the install instructions, as the last line before the final end
system("mkdir -p Pods/Headers/Public/FirebaseCore && cp Pods/FirebaseCore/Firebase/Core/Public/* Pods/Headers/Public/FirebaseCore/")

firebase_admob - when using this plugin strictly for ads, pod unnecessarily installs firebase core and other plugins only on iOS side

I use firebase_admob plugin in my flutter project and don't intend to include any other firebase related plugins like firebase_analytics, firebase_core, etc. So, my android side of the development seems very neat and all the Ads implementation is totally fine.
But from the iOS side, there seem to some config steps which I'm not able to narrow down. There is no proper documentation also regarding this.
Now, Correct me if my understanding is wrong.
podfile is a generated one based on the pubspec.yaml file with regard to flutter ios side. And the terminal command 'pod install' installs all the dependent plugins for iOS automatically. But here is the actual problem, instead of installing only the AdMob part as a standalone plugin, the pod installs all other firebase_core, analytics, etc too, which I don't expect. I want it exactly to be similar to the android side. Because of this, I get this Google-services-info.plist is not set up and all that which I haven't done either in android with 'google-services.json'.
Why should I have to forcibly include the google analytics part when I look only for Ads? Why there is no straightforward way to install only the AdMob part with the firebase_admob as in android.
And since the podfile is an auto-generated one pulling all the needed plugins from the pubspec.yaml. i'm not sure if I can add the standalone 'pod firebase_admob . and run pod update.
But still not sure how this will remove the other firebase plugins.
In fact, even after manually removing the dependencies from the pods.xcodeproj's target, pod update restores all the removed plugins again. How to sort this out.?

Resources