React native IOS Xcode build failing for bitcode - ios

I am new to React Native. I am trying to build my app on my ios device. It is building fine in the emulator but whenever I try to do it on my ios device I am getting the following error (picture attached).
It used to build regularly on ios device. It stopped working after I installed firebase to it following the documentation,
https://rnfirebase.io/#3-ios-setup
Not sure but it might be a flipper issue with static libraries? But really struglling here on this for a few days. I even tried enabling and disabling the bitcode option in build setting and still the same error.

Seems like this is a problem with react native 0.69.1. The workaround (as detailed here) is to disable bitcode in xcode settings:
Then add the following to post_install in your podfile:
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
end
It should look like this:
Make sure to comment out flipper as well
Finally run pod install in the iOS directory

Related

Firebase doesn't build on M1 simulator (Cannot find 'Analytics' in scope)

Since I have switched to M1, it has proven impossible running the app on the simulator. On the device itself it works fine.
I get the build error: Cannot find 'Analytics' in scope
import Firebase
class AlertService: AlertServiceBase, AlertServiceProtocol {
func showWarningAlert(dict: NSDictionary) {
...
Analytics.logEvent("blocked_no_more_warning", parameters: nil)
}
}
I spoke to an Apple engineer and he said to change all Pods architecture to Standard Architectures (arm64, armv7) - $(ARCHS_STANDARD).
It helped a bit to progress further, but then it failed on the firebase analytics issue. He suggested to post the issue here on SO. Hopefully someone had this before. Thanks
I had this issue only when debugging on a physical device, simulator worked fine.
Additional to the import Firebase, I had to import FirebaseAnalytics
Go to Project (NOT TARGET)
Build Settings
Excluded Architectures
Debug -
Add a new setting called
Any iOS Simulator SDK - arm64
If you are using Pods, you should repeat above for your Pods PROJECT as well.
Some pod targets (like pod KeychainAccess in your case) might not be respecting what you had set at Pods PROJECT level, you might want to fix this exact same thing for offending Pod targets as well.
Or instead of checking all of the pod targets one by one, you could add this at the end of your podfile -
post_install do |installer|
installer.project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
end
end
After doing this, do a pod install and a clean build, you should be good to go.
Run pod update to update to a more recent Firebase version. Firebase fully supports the M1 simulator since about the 7.7.0 release.

Could not find module 'XXXX' for target 'x86_64-apple-ios-simulator'; found: arm64, arm64-apple-ios-simulator in Swift Project?

This error has been stopping me progress with my project for a while now and nothing seems to be working for me.
I have added A pod to my swift project but when I try to import it into my app, I get this error:
Could not find module 'ImagePicker' for target 'x86_64-apple-ios-simulator'; found: arm64, arm64-apple-ios-simulator
I've searched far and wide and tried almost all the solutions and still nothing seems to be working.
I'm using the latest Xcode.
is there anything I need to do fix this as this is stopping me from building the app.
I have the same issue on the M1 laptop.
Have you tried this solution:
post_install do |installer_representation|
installer_representation.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
end
end
end
Alternatively, you can change default scheme to Release, instead of Debug, by going to the top menu Product -> Scheme -> Edit Scheme, select your Run scheme as Release.
However, better solution would be to simply make sure you're running Xcode using Rosetta. Simple do the Get Info on the Xcode icon, from there in popup window make sure that Open using Rosetta is checked
I'm using SPM for dependency management and ran into issues with my M1 laptop.
I had Excluded architectures within the top level project build settings set to arm64, which is where I ran into the problem
After I removed that it worked.
Here's a screenshot of the Architectures section in the Project build settings, after making the change (ignore dark mode look, I was switching laptops).

why are after a new react-native project lots of deprecation warnings?

steps to reproduce:
installed versions:
react 15.4.2
react-native 0.40.0
create a new Project
react-native init reactNativeTest
Running Project
1) Start Xcode
2) Open Project reactNativeTest
3) Run App
when I run it in xcode I get hellot of deprecation warnings, semantic issues and CoreFoundation Errors.
see screenshot
These are known issues in React Native 0.40 (reported in React Native github project as issue #11736) that occur for others (myself as well) on a fresh project.
As of 17 minutes ago, there are a number of pull requests which reduce some of the issues.
One commenter on the issue reports that "Those are warning and you can mostly ignore those warning. You project should run fine with those warning." I've confirmed this, but hopefully we'll get these warnings cleaned up soon.
Why
The OS Deployment target is way too low for many of these dependencies. Some are set to iphone 4!
I created a bug in React Native with this same solution
Solution
Copy function min_OSTarget_post_install into your Podfile
Call the function within post_install
pod install
See hundreds of Xcode warnings dissapear
Code
def min_OSTarget_post_install(installer)
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
if Gem::Version.new('8.0') > Gem::Version.new(config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'])
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
end
end
end
end
post_install do |installer|
...
min_OSTarget_post_install(installer) // ADD THIS LINE
end

Unable to archive build with Share Extension and AFNetworking Cocoapod

I've got a share extension set up for my app and I'm using AFNetworking through a cocoapods install.
I was able to build and run the app through simulator and my phone via debug builds but when I tried to archive to submit to the app store I ran into a warning:
linking against dylib not safe for use in application extensions
AFNetworking
Archive builds would complete but they would be corrupted and unusable.
My solution is to stop using cocoapods for my app extension and manually add the AFNetworking files to my Compile Resources build setting.
I'm just wondering if others have had this issue OR if they have had no problems using AFNetworking cocoapod to submit an extension to the store.
I have checked out the Apple Guidelines and was using arm64 architecture and had set the target’s “Require Only App-Extension-Safe API” build setting to Yes.
As far as i know the latest version of cocoapods should set automatically "Allow app extension API only" flags to all libs targets if pods library is properly linked to extension target(s) (check targets from Pods.xcodeproj). If it doesn't happen you can try to set it manually in post_install hook. You can try this one:
post_install do |installer_representation|
installer_representation.project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'YES'
end
end
end

Build error: "Unknown type name 'ffi_cif'"

When building my XCode project, for one of my cocoapod dependencies, libffi, I get 5 build errors, all along the lines of /Pods/libffi/ios/include/ffi_common.h:77:1: Unknown type name 'ffi_status'
Any ideas what I could try to debug it? I've already tried cleaning the project.
I have the same issue. Xcode 5.1 and Xcode 6.0 GM, both ios device and simulator.
This is also worked for me : http://cameronspickert.com/2014/01/20/remove-the-arm64-architecture-from-cocoapods-targets.html.
I had this problem compiling an open source project on iPhone 6 simulator.
Built it for earlier devices and it worked fine
There is an up-to-date solution. The problem is still the same, the 64-bit arch support for some third party library. Add this at the bottom of your Podfile:
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |configuration|
target.build_settings(configuration.name)['ARCHS'] = '$(ARCHS_STANDARD_32_BIT)'
end
end
end
It's a bit different (updated) from the indicated in one of the post above.

Resources