Cannot run iOS React Native app in Release Schema - ios

When I switch my iOS project to the release schema (as described https://facebook.github.io/react-native/docs/running-on-device.html), I get this error:
2016-11-29 11:49:01.621 [fatal][tid:main] No script URL provided. Make sure the packager is running or you have embedded a JS bundle in your application bundle.unsanitizedScriptURLString:((null))
Do I need to create a static js bundle in production mode? The docs suggest that in earlier React Native docs, but I'm running React Native 0.35 (originally 0.30)

Finally resolved my issue. I was using a babel plugin to remove console.log statements as suggested by the docs. Removing the plugin got things working again

We solved this by unchecking "Run script only when installing" in XCode->Project Settings->Build Phases->Bundle React Native code and Images

Looks like Facebook is suggesting a babel-plugin-transform-remove-console solution that just does not work:
See issue https://github.com/facebook/react-native/issues/10412
I think something like this is badly needed to auto-remove console.log statements in a release build.

Related

Ionic app loads using Ionic serve but not with Xcode

I'm currently stuck on a problem related to my Ionic project.
I have an Ionic project on GitHub which i've been working on in the past few weeks, i have a few Cordova plugins as part of the project.
When downloading the project from GitHub, i can run the app using Ionic Serve without a problem. However, when trying to setup the project for xCode to run on local device(s), i run into a multitude of errors
Some include:
When running ionic 'cordova platform add ios' the following error appears
Error: Could not install from "ios" as it does not contain a package.json file.
When trying to run 'ionic cordova run ios -l --external'
Error: Error: terminating with uncaught exception of type NSException
I have not yet tried to transfer my code into a new Ionic project, as i wish to see if my problem can be solved without that hassle.
View project code here: https://github.com/designsheikh/bitsandbobs.git
I figured it out. You have the exact same issue I've had with the android platform.
As I pointed it out in the comments, it is indeed caused by a "corrupted" project architecture.
How it happened
Initially, I had an issue with the cordova generated resources, somehow not being copied into the android platform directory. I tried plenty of things with the cordova-res CLI, including using the --copy and the --ios-project flags to force the copy to happen in the directory of my choice.
I couldn't manage to fix my issue, and then decided to rollback all my changes and start over on a clean project to try something else. Since then, I was not able to add the android platform anymore. Every single time, the following error was being thrown :
Error: Could not install from "android" as it does not contain a package.json file.
Explanation
With all my testing, I noticed that when using cordova to add the platform or copy the resources over, somehow, it had created the android platform in the wrong directory, at the root of my project instead of in the platforms folder. And that's where the issue comes from.
I can't explain it, but you will encounter this error every single time if you try to add a platform with cordova while having a folder with this platform name at the root of your project. I have no idea why this would prevent a platform from being added to the project, maybe this folder is used as a temp folder by the CLI.
Solution
The fix is to simply remove any ios or android directory at the root of your project.
The error will go away and you will be able to add the platform again.
#CodingJunkie
Regarding the Github repository you provided in your post, you will likely run into another error while trying to add the ios platform if you use cordova#>=9.0.0.
Using "requireCordovaModule" to load non-cordova module "xcode" is not supported.
Instead, add this module to your dependencies and use regular "require" to load it.
Check this issue#1033 for a workaround. However, it's not recommended to directly edit the plugin source code, you might want to look for another cordova Firebase plugin.
I also noticed you kinda mixed up cordova and capacitor in your project.
Make sure to use one or the other to avoid potential errors.
Hope this helped !
#Reqven
Thank you for your support! - i was sure that i had done this step while trying to fix the issue. It is such an absurd problem, it seems that there is a new project architecture as you mentioned which needs to be followed. I followed your steps with also one minor additional step as im working on the iIOS platform:
Delete iOS folder
cordova platform add ios
cordova prepare ios
ionic build
If step 2 throws an error causing the version not to be found or integrated into the project run - include '#latest' this also solved my problem

Fastlane Apple Generic versioning not enabled in this project

What I’m doing is trying to make bitbucket pipline do my iOS CD, I included docker fastlanetools/fastlane image and in the steps i pull and run the docker image everything is okay and i was able to let fastlane command work by calling fastlane beta in the steps.
What’s happening is that fastlane exits with the error
Apple Generic versioning is not enabled in this project.
I followed apple documentation to enable it from xCode
from here
I changed all the targets in my project to use App Generic and still not working
In case it was this issue xcrun avgtool xcrun: error: unable to find utility "avgtool", not a developer tool or in PATH
after
sudo xcode-select -s /Applications/Xcode.app
fastlane stopped complaining
In my case it was the issue of Command Line Tools, which wasn't specified under the location tab.
Add your xcodeproj path.
Like
increment_build_number(
xcodeproj: '../XXX.xcodeproj',
build_number: number
)
I met the same problem. I searched and tried a lot of ways, but still not worked it out. A flash of inspiration came to my mind. I set a certain version via increment_version_number, it was succeeded magically. Then I tried increment_version_number again to make it automatically increment the version number. Lucky me, it worked.
I had two installations of macOS but Xcode only on one of them, after updating I lost the command line tools location. After setting that up in the preferences it worked again
What i missed was missed setting CURRENT_PROJECT_VERSION
(whz. Current Project Version) build setting, which specifies the current version of your project.
Reason:
By default, Xcode does not use any versioning system & no value for Current Project Version. So setting versioning system to Apple Generic ensures that Xcode will include all agvtool-generated version information in your project.
Reference
So make sure, your below set values for
I highly recommend using this plugin if your issue is not having argvtool accessible in CI/CD when trying to bump stuff uniformly for both IOS/Android before it does it in the macOS runner or action etc
In my case this problem appeared after I updated Xcode and my xcode-select was pointing to the missing folder.
After I executed xcode-select -s /Applications/Xcode_13_4.app Fastlane continued working as it used to before.

React-Native: Build error GeneratedInfoPlistDotEnv.h file not found

I had a old React-Native project which I wanted to give it a try again and when trying to run the project on iOS (Android works perfect) I get the error that Debug-iphonesimulator/GeneratedInfoPlistDotEnv.h file not found.
If I run the project from the command react-native run-ios, than the build will succeed.
What can cause this issue and how can it be fixed?
I have tried to fix it with the comments from this issue but no success.
React-Native verision: 0.47
Full error:
<built-in>:1:10: fatal error:
'/Users/myUser/Library/Developer/Xcode/DerivedData/Project-gcaxrvbcwgkfhkadevoqxcprxszw/Build/Products/Debug-iphonesimulator/GeneratedInfoPlistDotEnv.h' file not found
I fixed by copying file GeneratedInfoPlistDotEnv.h (in /ios/build/Build/Products/) to the path mentioned in the error message.
The path mentioned in error message for simulator is not same as real phone, you need to copy for a second time.
The development for React Native just like droped in a deep black hole, what you need to do is just climb and climb and climb...
Changing the Info.plist preprocessor prefix file to works for me ${CONFIGURATION_BUILD_DIR}/../GeneratedInfoPlistDotEnv.h
Image of code in Xcode 9
If you're coming from React version 0.60 and above, you should be referencing the package from GitHub instead of NPM. The author hasn't released auto-linking support on NPM yet, even though it's already merged!?
Try these steps after you unlink and uninstall the existing version of react-native-config. Remember to revert to default Info.plist preprocessor settings in XCode build settings.
yarn add https://github.com/luggit/react-native-config.git
cd ios && pod install
You don't have to add any other post-install scripts, just run the app like usual and it should work fine. Make sure you undo any other fixes before doing this.

Cordova File plugin breaks my app

I just installed the cordova file plugin and it completely breaks my application with this error:
ERROR: Method 'requestAllPaths:' not defined in Plugin 'File'
After googling for several variations of this topic I wasn't able to find anything that addresses this issue. Any ideas?
I am using Cordova 3.5.0 with the file plugin added like this:
cordova plugin add org.apache.cordova.file
I tried adding the optional configuration described in the readme on github but that didn't change anything.
This is the error code that I am getting when I run:
cordova run ios
[CDVCommandQueue executePending] [Line 158] FAILED pluginJSON = [
"File1936338184",
"File",
"requestAllPaths",
[
]
]
I am absolutely clueless as to why this is happening or where.
Somewhere in the App you are making a call to requestAllPaths.
As far as the File API documentation goes there is no such method as requestAllPaths
There is an API called requestFileSystem.
Hope it helps to debug your app
edit1:
You can have a look here for a similar issue.
Actually, the error happens if the plugin was already added to your project : in that case, it seems that the Cordova build process only updates the javascript interface but not the underlying native iOS sources, which explains the missing code :(
To fix it, you should remove the plugin beforing adding it :
cordova plugin rm org.apache.cordova.file
cordova plugin add org.apache.cordova.file
Be aware though that you might run in some additional issues : even if the files are properly updated in your platforms/ios/project_name/plugins directory, they might not be properly referenced in xcode => cf. cordova 3.4 with xcode 5.1 won´t build with latest file-transfer plugin
Hope it helps,
Cheers,
D.

Cordova_Plugins.js Not Found

I am running Cordova 2.9.1 for iOS. When I run my app in the browser, the console says I am missing cordova_plugins.js.
What is that? How do I get it?
Is that the reason none of my plugins are working at all?
Thanks!
Have you added the "browser" platform to your Cordova project?
cordova platform add browser
After which, you need to build the Cordova project:
cordova build browser
You'll notice the platforms/browser/www folder exists and contains a cordova_plugins.js file.
At this point, you need to "serve" files to your web browser from that folder (to test your app using a web browser). I use Grunt and the NodeStatic task for this purpose.
Hope this helps! Let me know if you have any questions, take care.

Resources