Why does my xcode project build on simulator but not device in xcode project? - ios

I have a react native project that runs successfully on simulator but not on device.
I have run the project on the same device before, but not since I've incorporated cocoapods, though none of the above library are in cocoapods. I'm building in xcworkspace rather than a project file, not sure if that is it.
Not sure what this could be... Any suggestions appreciated!

Usually these type of errors appear when the libraries are not linked with the project.
The libraries might have been unlinked after adding cocoapods. Try running npm install and then react-native link to link all the libraries or run react-native link <library-name> to link the specific library in the terminal from your project root directory.

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)

Renaming a React Native project

I have a working react native app (without expo), running and compiling in both Android and iOS devices. Now I'm trying to rename the app, but I'm having problems with that.
Steps followed:
I have deleted both ios and android directories.
Changed the project name in my app.json
Regenerated the android and ios directories with react-native upgrade --legacy (cause eject is not working anymore)
Updated my podfile with the need
Pod install
When i tried to compile my app via xcode, I got "null is not an object (evaluating '_RNGestureHandlerModule.default.Direction')
I guessed that was due to the autolinking when you install some react native third party components. So I deleted node_modules, and installed all react native navigation again. Then I ran react-native link. The previous error went away.
Now, I'm stuck with:
Target 'cjlrnneTests' has target dependency on Target 'cjlrnne'
That command depends on command in Target 'cjlrnne': script phase “[CP] Copy Pods Resources”
Honestly, I don't know what else more to do / look for.
Can anyone please provide with some clue, or the steps to change a RN app's name?
Thanks!
You can try this package for renaming the app.
react-native-rename
https://www.npmjs.com/package/react-native-rename
react-native-rename <newName>
It will automatically configure all the things.

How to compile xcode project?

I have an Xcode project for an iOS app as a legacy project. Full source code, it works 100%. I need to publish it to AppStore. But I have never used Xcode, macOS or done any ios app development related stuff and I have problems to compile it and not sure if I am doing it correctly.
I tried "Product->Run" and "Product->Build". I always get "Build Failed" and some errors. In the navbar, I choose "iPhone 7 (10.3.1)" and some other versions as well. Errors I get -
But as I mentioned, it is a finished app and I don't feel I should be making any changes to the code and not to a 3rd party code (SDWebImage).
I want to compile this project so I get the .ipa file. What is the step-by-step approach to getting a .ipa file from source code?
You mentioned in the comments that you downloaded and unpacked a .zip of the project. Your issues are most likely caused by a conflict in the way the dependencies were setup.
Try delete the pods folder and run pod install in terminal, in the root project folder, to re-install all the project dependencies.

Installing react-native-custom-segmented control, need to install ios framework to react-native project

I'm trying to install this: https://github.com/wix/react-native-custom-segmented-control into my react-native project.
In the installation instructions, it says to move the .xcodeproj file to my project folder. I dragged it to the root folder of my project (though I am not sure that is right).
Then the instructions say to add the libCustomSegmentedControl.a file to my target's library.
The project was initialized using expo and I don't think it has a xcode target project? I am confused as to how to proceed in installing this. Is there a secret place in a react-native app that I can find the xcode project?
I'm a beginner with ios so any help would be really appreciated!
If you created the project using expo then you need to eject it before you can install any module that expo doesn’t support.
You can find more info at this link.
https://docs.expo.io/versions/latest/expokit/eject
Expo doesn’t actually have an Xcode or Android project inside the code base, so you can’t add react-native-custom-segmented-control to an expo project.
This post does a good breakdown of the differences between creating a react-native project using expo or react-native init
https://stackoverflow.com/a/49324689/5508175

Resources