Why is ios packaging inconsistent with using xcode run directly? - ios

The react native project uses xcode to run on the simulator and real machine, and the image resources are displayed normally, but after being packaged into ipa, some images will not be displayed. I've tried cleaning the project, rebuilding, but the result is still the same

Related

React Native, iOS, trying `yarn run ios` and I get RCTAppDelegate.h not found

Trying to build a React Native iOS app, and while I got it running fine using Android, trying to get it running on iOS has been a bit of a nightmare.
I created this base react native app, back in Sept 2022, doing the typical npx react-native init <projectname> and was working on android mostly (I use a linux box, and I have to use Teamviewer to connect to a mac to build the iOS apps).
I had my app working fine in android and iOS, and then added the Zoom Video SDK and everything went to hell. Got it working fine in Android, and tried to take my changes and build them in iOS but I couldn't get it to work, and seemingly got my iOS project corrupted, so I tried to create a fresh iOS project, by basically created a same-named project in a different directory, and replacing the <projectname>/ios with the new base ios project.
Of course, I did this Jan 2023, so it's the new architecture, and the AppDelegate.h tries to import the RCTAppDelegate.h file instead of React/RCTBridgeDelegate.h
I do my usual yarn install go into the ios directory and pod install and then try to do a yarn run ios and it tells me it can't find RCTAppDelegate.h
Anyone solve this yet? The React-Native docs aren't up to date with their github repo
I got the same error, i solved it by opening the .xcworkspace instead of opening .xcodeproj
I also cleaned the build folder by
Product --> Clean Build folder
and then it successfully built the app.

SwiftUI Package dependencies isn't working in real iOS device

I've implemented packages in SwiftUI using Add Package These packages are working fine in the simulator. But when I've tried to run on a real iOS device (iPhone 8 plus). It is showing the error. I've deleted Derived data and Clean Build Folder and Build. Even I've restarted Xcode, removed packages, and again re-added then also it's not working on real deivce.

Not able to archive my app onto the New Build System on Latest Xcode

I am using Xcode 12.5.1, using native iOS to build my app. When I switch to New Build System I can run my app on my iPhone but I get error when I archive to make a production build.
Error:
Showing Recent Messages
duplicate output file '/Users/shashi/Library/Developer/Xcode/DerivedData/{project_name}-fqroszphviylkoamlhyrgcdwnfyc/Build/Intermediates.noindex/ArchiveIntermediates/{project_name}/BuildProductsPath/Release-iphoneos/{project_name}.swiftmodule/arm64-apple-ios.swiftdoc' on task: Ditto /Users/shashi/Library/Developer/Xcode/DerivedData/{project_name}-fqroszphviylkoamlhyrgcdwnfyc/Build/Intermediates.noindex/ArchiveIntermediates/{project_name}/BuildProductsPath/Release-iphoneos/{project_name}.swiftmodule/arm64-apple-ios.swiftdoc /Users/shashi/Library/Developer/Xcode/DerivedData/{project_name}-fqroszphviylkoamlhyrgcdwnfyc/Build/Intermediates.noindex/ArchiveIntermediates/{project_name}/IntermediateBuildFilesPath/{project_name}.build/Release-iphoneos/{project_name}.build/Objects-normal/arm64/{project_name}.swiftdoc
I have tried to find duplicate files in Copy Bundle Resources but it's impossible cause I have lots of xibs files.
I am not able to upgrade to Xcode 13 cause of this issue.

Xcode Simulator using cached files

I am running a Cordova app and when I open it using Xcode (iOS Simulator) it shows the updated code files in Project Navigator. I then run Product -> Clean and run the code on the simulator but it still uses a previous version of the HTML/JS files.
How do I get the simulator to build again from the updates source files? It seems they are somehow cached and I can't seem to get it cleared.
Use cordova build ios first and then run the app in simulator.

React Native app not running in XCode iOS simulator

I try to make my first steps using React Native. Development for Android (on Windows host) works. Now I wanted to test iOS, and tried to set up a development environment on a MacBook Pro.
Problem: React Native starts the iOS simulator, and then nothing happens any more. The simulator runs OK, but my React native app won't start.
What do I need to do to get my React Native installation going?
More Info:
I set up XCode and React Native according to the docs on the MacBook Pro running OSx 10.13.2 (High Sierra). XCode was installed and tested successfully, including the simulator.
When I installed Node.js I deliberately picked an older version (containing npm 4.2.0), since forums say that React Native does still have problems with npm 5. I also installed Homebrew and Watchman, like stated in the docs.
To initialize an empty project, I used
create-react-native-app HelloWorldProject
and a projet structure got created in my Documents folder.
If I finally fire up my "Hello World" test app using
cd HelloWorldProject
sudo react-native run-ios
the system responds:
Starting packager ...
Starting simulator ...
and then nothing happens. The simulator does indeed start (boot --> apple logo --> progress bar --> IOs start screen), but nothing happens afterwards.
Edit
I have given up on React Native for several reasons, I leave this question here for documentary purposes, but I cannot verify or accept any answer, I don't have a React Native development environment any more.
It's probably because you used sudo. /.expo/ is owned by root. Try to change the ownership with
sudo chown -R `whoami` ~/.expo
Refer https://github.com/react-community/create-react-native-app/issues/422
Even everything in your app seems fine, sometime you face the issue that the app is taking too much time to load either through terminal or Xcode. If there is no any other specific issue with your project, the following solution works most of the time:
Go to your app folder and then go to 'iOS' folder.
Delete 'Podfile.lock' and 'Pods' folder.
Execute the following command in Terminal from your 'ios' folder, that will bring back the 'Podfile.lock' and required Pods will be installed to 'Pods' folder:
pod install
Delete the 'build' folder in your 'iOS' folder.
Run the following command in terminal:
react-native run-ios
While the terminal is running, open '.xcworkspace' in your 'ios' folder in Xcode.
The above steps will make sure it will be build your react native project newly and will run on the simulator.
Thanks
Wasantha Wijayaratna

Resources