iOS Simulator crashes when clicking on Map - react-native

So I have an issue only with the simulator for iOS, I can interact with the map for about two seconds before the whole app crashes...
When I use my own device, it works fine...
here's a gif: https://gyazo.com/67a5d7f10586d0368eb631346122867b
Here is my implementation:
import React, { useEffect } from "react";
import { StatusBar } from "react-native";
import MapboxGL from "#react-native-mapbox-gl/maps";
function MapScreen() {
const context = useEquipment();
// const { deployedEquipment } = context!;
const defaultCameraCoordinates = {
latitude: context?.location?.latitude ?? 0,
longitude: context?.location?.longitude ?? 0,
};
return (
<>
<StatusBar animated={true} backgroundColor="black" barStyle="dark-content" />
<MapboxGL.MapView style={styles.map}>
</MapboxGL.MapView>
</>
);
}
The error from the device:
Application Specific Information:
dyld4 config: DYLD_ROOT_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot
terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[0]'
abort() called
CoreSimulator 783.5 - Device: iPhone 13 (D63AEBAD-44FF-4884-8F91-259CAEA4FC7F) - Runtime: iOS 15.2 (19C51) - DeviceType: iPhone 13
Podfile:
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/#react-native-community/cli-platform-ios/native_modules'
platform :ios, '11.0'
target 'DigiCatchRN' do
config = use_native_modules!
use_react_native!(
:path => config[:reactNativePath],
# to enable hermes on iOS, change `false` to `true` and then install pods
:hermes_enabled => true
)
target 'DigiCatchRNTests' do
inherit! :complete
# Pods for testing
end
pre_install do |installer|
$RNMBGL.pre_install(installer) #mapbox
end
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable the next line.
use_flipper!()
post_install do |installer|
react_native_post_install(installer)
__apply_Xcode_12_5_M1_post_install_workaround(installer)
$RNMBGL.pre_install(installer) # mapbox
end
end

I finally found a solution for this, and it turns out that my simulator runs ios 15.2 crashed. When I downloaded another version below this version. In my case 13.5. It finally works :)

Related

Build fails for React Native in iOS due to RNSVG

I have a react native app which is working fine on android but when i try to run npx react-native run-ios I'm getting the following error
2023-02-15 17:23:36.048 xcodebuild[81512:522416] [MT] IDEFileReferenceDebug: [Load] <IDESwiftPackageCore.IDESwiftPackageSpecialFolderFileReference, 0x7fd3caff3490: name:Docs.docc path:group:Docs.docc> Failed to load container at path: /Users/shubhagarwal/Library/Developer/Xcode/DerivedData/weedlemobiledapptraining-cngaloxjuncutwengkgnppfnmbtd/SourcePackages/checkouts/swift-protobuf/Sources/protoc-gen-swift/Docs.docc, Error: Error Domain=com.apple.dt.IDEContainerErrorDomain Code=6 "Cannot open "Docs.docc" as a "Swift Package Folder" because it is already open as a "Folder"." UserInfo={NSLocalizedDescription=Cannot open "Docs.docc" as a "Swift Package Folder" because it is already open as a "Folder".}
** BUILD FAILED **
The following build commands failed:
Ld /Users/shubhagarwal/Library/Developer/Xcode/DerivedData/weedlemobiledapptraining-cngaloxjuncutwengkgnppfnmbtd/Build/Products/Debug-iphonesimulator/RNSVG/RNSVG.framework/RNSVG normal (in target 'RNSVG' from project 'Pods')
(1 failure)
This is how my Podfile looks like
require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking")
require File.join(File.dirname(`node --print "require.resolve('react-native/package.json')"`), "scripts/react_native_pods")
require File.join(File.dirname(`node --print "require.resolve('#react-native-community/cli-platform-ios/package.json')"`), "native_modules")
require 'json'
podfile_properties = JSON.parse(File.read(File.join(__dir__, 'Podfile.properties.json'))) rescue {}
$RNFirebaseAsStaticFramework = true
platform :ios, podfile_properties['ios.deploymentTarget'] || '12.0'
install! 'cocoapods',
:deterministic_uuids => false
target 'weedlemobiledapptraining' do
use_expo_modules!
use_modular_headers!
# use_frameworks!
config = use_native_modules!
# use_frameworks! :linkage => podfile_properties['ios.useFrameworks'].to_sym if podfile_properties['ios.useFrameworks']
# Flags change depending on the env values.
flags = get_default_flags()
use_react_native!(
:path => config[:reactNativePath],
:hermes_enabled => flags[:hermes_enabled] || podfile_properties['expo.jsEngine'] == 'hermes',
:fabric_enabled => flags[:fabric_enabled],
# An absolute path to your application root.
:app_path => "#{Dir.pwd}/.."
)
# Uncomment to opt-in to using Flipper
# Note that if you have use_frameworks! enabled, Flipper will not work
#
# if !ENV['CI']
# use_flipper!()
# end
post_install do |installer|
react_native_post_install(installer)
__apply_Xcode_12_5_M1_post_install_workaround(installer)
end
post_integrate do |installer|
begin
expo_patch_react_imports!(installer)
rescue => e
Pod::UI.warn e
end
end
end
Versions :
node : 14.21.2
React : 17.0.2
React Native : 0.68.2
XCode : 12.1
I've tried everything that I could find on the internet.
Reinstalled Node Modules and Pods several times
Tried to make the build without use_frameworks! or use_modular_headers!
Adding glog to the podfile
You need to run
pod install --project-directory=ios --repo-update
command to install pod dependencies

React Native iOS build failing due to glog and React Logger

I have a react native app which is working fine on android but when i try to run npx react-native run-ios I'm getting the following error
2023-02-16 11:27:07.190 xcodebuild[10406:767829] [MT] IDEFileReferenceDebug: [Load] <IDESwiftPackageCore.IDESwiftPackageSpecialFolderFileReference, 0x7f95f65afc30: name:Docs.docc path:group:Docs.docc> Failed to load container at path: /Users/shubhagarwal/Library/Developer/Xcode/DerivedData/weedlemobiledapptraining-cngaloxjuncutwengkgnppfnmbtd/SourcePackages/checkouts/swift-protobuf/Sources/protoc-gen-swift/Docs.docc, Error: Error Domain=com.apple.dt.IDEContainerErrorDomain Code=6 "Cannot open "Docs.docc" as a "Swift Package Folder" because it is already open as a "Folder"." UserInfo={NSLocalizedDescription=Cannot open "Docs.docc" as a "Swift Package Folder" because it is already open as a "Folder".}
** BUILD FAILED **
The following build commands failed:
CompileC /Users/shubhagarwal/Library/Developer/Xcode/DerivedData/weedlemobiledapptraining-cngaloxjuncutwengkgnppfnmbtd/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-logger.build/Objects-normal/x86_64/react_native_log.o /Users/shubhagarwal/Desktop/metawork/portal-react-native/node_modules/react-native/ReactCommon/logger/react_native_log.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'React-logger' from project 'Pods')
(1 failure)
If I try to build it via XCode, this is what the error looks like
This is how my Podfile looks like
require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking")
require File.join(File.dirname(`node --print "require.resolve('react-native/package.json')"`), "scripts/react_native_pods")
require File.join(File.dirname(`node --print "require.resolve('#react-native-community/cli-platform-ios/package.json')"`), "native_modules")
require 'json'
podfile_properties = JSON.parse(File.read(File.join(__dir__, 'Podfile.properties.json'))) rescue {}
$RNFirebaseAsStaticFramework = true
platform :ios, podfile_properties['ios.deploymentTarget'] || '12.0'
install! 'cocoapods',
:deterministic_uuids => false
target 'weedlemobiledapptraining' do
use_expo_modules!
use_modular_headers!
# use_frameworks!
config = use_native_modules!
# use_frameworks! :linkage => podfile_properties['ios.useFrameworks'].to_sym if podfile_properties['ios.useFrameworks']
# Flags change depending on the env values.
flags = get_default_flags()
use_react_native!(
:path => config[:reactNativePath],
:hermes_enabled => flags[:hermes_enabled] || podfile_properties['expo.jsEngine'] == 'hermes',
:fabric_enabled => flags[:fabric_enabled],
# An absolute path to your application root.
:app_path => "#{Dir.pwd}/.."
)
# Uncomment to opt-in to using Flipper
# Note that if you have use_frameworks! enabled, Flipper will not work
#
# if !ENV['CI']
# use_flipper!()
# end
post_install do |installer|
react_native_post_install(installer)
__apply_Xcode_12_5_M1_post_install_workaround(installer)
end
post_integrate do |installer|
begin
expo_patch_react_imports!(installer)
rescue => e
Pod::UI.warn e
end
end
end
Versions :
node : 14.21.2
React : 17.0.2
React Native : 0.68.2
XCode : 12.1
I've tried everything that I could find on the internet.
Reinstalled Node Modules and Pods several times
Tried to make the build without use_frameworks! or use_modular_headers!
Adding glog to the podfile

react-native-webrtc/RTCView.js Attempted import error: 'requireNativeComponent' is not exported from 'react-native-web/dist/index'

Hey guys I'm using Expo 40 SDK minimal Setup.
And I'm trying to use a library called react-native-webrtc so whenever I try I get an error
So whenever I do an import of any kind
import {
RTCPeerConnection, RTCIceCandidate, RTCSessionDescription, RTCView, MediaStream,
MediaStreamTrack, mediaDevices, registerGlobals
} from 'react-native-webrtc';
This happen
react-native-webrtc/RTCView.js Attempted import error: 'requireNativeComponent' is not exported from 'react-native-web/dist/index'.
I navigate to the ios folder and I changed inside PodFile
It was
platform :ios, '10.0'
I make it
platform :ios, '11.0'
I run pod install
And then I did npm run ios and it solved it was because of the ios version => 11.0.

Cannot read property 'getCurrentAccessToken' of undefined

It seems like AccessToken is undefined in my code
import {AccessToken} from 'react-native-fbsdk';
AccessToken.getCurrentAccessToken().then(
(data) => {....}).catch(e => {
console.log('fb could not connect because: ' + e);
})
catch is being invoked.
I am using "react-native-fbsdk": "^1.0.1"
my device : iOS simulator - iphone62 - iOS 12
my Podfile:
pod 'FBSDKCoreKit'
pod 'FBSDKLoginKit'
pod 'FBSDKShareKit'
pod 'Bolts'

react-native adding crashlytics

I'm new to react-native .
I'm trying to add crashlytics to my app , this is my podfile:
# Required by RNFirebase
pod 'Firebase/Core', '~> 5.15.0'
pod 'Firebase/Auth', '~> 5.15.0'
pod 'Fabric', '~> 1.9.0'
pod 'Crashlytics', '~> 3.12.0'
pod 'GoogleIDFASupport', '~> 3.14.0'
this is my code:
import React, {Component} from 'react';
import {View} from 'react-native';
import {Provider} from "mobx-react";
import rootStore from './src/stores/RootStore';
import firebase from "react-native-firebase";
class App extends Component {
componentDidMount(){
firebase.crashlytics().enableCrashlyticsCollection();
}
render() {
return (
<Provider rootStore={rootStore}>
<View/>
</Provider>
)}
}
export default (App);
I get this error message :
371d29ab-9482-42bd-a…-4915912912cd:25629 Error: You attempted to use a firebase module that's not installed natively on your iOS project by calling firebase.crashlytics(). Ensure you have the required Firebase iOS SDK pod for this module included in your Podfile, in this instance confirm you've added "pod 'undefined'" to your Podfile
Am I missing something?
Just like you, I got the same issue today... even if it works before like a charm.
Strange, don't know how it came out of the blue!?!
I figured out, that if I open XCode -> Product -> Scheme and duplicate the Scheme and set Build-Configuration on that duplicated Scheme to Release, the Error didn't appear.
I've even tried to remove /ios/Pods and reinstall all the Pods. Didn't get it to work in Debug-Mode. Any Idea why?