Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all 16548 articles
Browse latest View live

Getting "Unhandled JS Exception: Native module cannot be null" Error on IOS runtime with React Native

$
0
0

Preparing a medium size production level app for IOS.

App uses a lot of native capabilities and and some point of attempting to integrate some of them I moved to using Cocoapods.manually using a Podfile file.

This helped me to over come all the build fails and could finally get the RN app running.

Only now, getting a very vague error:

Unhandled JS Exception: Native module cannot be null

Having a hard time to figure out which 3rd party package is causing this..a bunch of git issues are pointing to add the right package to Podfile file and pod install which I did, but still not joy.

Those are the `git issues, most of them in a specific package:

Most of those pretty much solve this the same way by adding to Podfile file the right pod link and running pod install - this did not worked for me

Things that I've tried:

  • Removing binary links but JavaScriptCore.framework and libPods-myProjectName.a
  • Clearing Libraries from all .xcodeproj packages to resolve duplicated linking
  • Cleaned project rebuilt, cleared packages with pod deintegrate and reinstalled.. basically cleared and reinstalled everything I could
  • Upgrade react-native from 0.58.6 to 0.59.9

Followed this blog post to convert my existing project to use Cocoapods`

Pod install seems pass without any errors - pod install output:

Analyzing dependenciesFetching podspec for `DoubleConversion` from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`Fetching podspec for `Folly` from `../node_modules/react-native/third-party-podspecs/Folly.podspec`Fetching podspec for `glog` from `../node_modules/react-native/third-party-podspecs/glog.podspec`Downloading dependenciesInstalling AppAuth (1.3.0)Installing BugsnagReactNative (2.23.1)Installing DoubleConversion (1.1.6)Installing Folly (2018.10.22.00)Installing RNDeviceInfo (2.3.2)Installing RNGestureHandler (1.1.0)Installing RNSVG (9.5.1)Installing RNShare (3.0.0)Installing RNSound (0.11.0)Installing RNVectorIcons (6.6.0)Installing React (0.59.9)Installing ReactNativePermissions (1.1.1)Installing boost-for-react-native (1.63.0)Installing glog (0.3.5)Installing react-native-camera (2.1.1)Installing react-native-image-picker (0.28.1)Installing react-native-image-resizer (1.2.0)Installing react-native-keep-awake (4.0.0)Installing react-native-netinfo (3.2.1)Installing react-native-orientation (3.1.3)Installing react-native-view-shot (3.1.2)Installing react-native-webview (5.7.0)Installing yoga (0.59.9.React)Installing ReactNativeNFC (1.0.0)Generating Pods projectIntegrating client projectPod installation complete! There are 31 dependencies from the Podfile and 23 total pods installed.

And the Podfile:

source 'https://github.com/CocoaPods/Specs.git'platform :ios, '9.0'target 'myProjectName' do  pod 'React', :path => '../node_modules/react-native', :subspecs => ['Core','CxxBridge','DevSupport','RCTText','RCTImage','RCTNetwork','RCTWebSocket','RCTSettings','RCTAnimation','RCTLinkingIOS',    # Add any other subspecs you want to use in your project    # Remove any subspecs you don't want to use in your project  ]  pod "yoga", :path => "../node_modules/react-native/ReactCommon/yoga"  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'  pod 'react-native-webview', :path => '../node_modules/react-native-webview'  pod 'RNSound', :path => '../node_modules/react-native-sound'  pod 'react-native-camera', :path => '../node_modules/react-native-camera'  pod 'RNDeviceInfo', :path => '../node_modules/react-native-device-info'  pod 'RNGestureHandler', :path => '../node_modules/react-native-gesture-handler'  pod 'react-native-image-picker', :path => '../node_modules/react-native-image-picker'  pod 'react-native-image-resizer', :path => '../node_modules/react-native-image-resizer'  pod 'react-native-keep-awake', :path => '../node_modules/react-native-keep-awake'  pod 'react-native-orientation', :path => '../node_modules/react-native-orientation'  # permissions_path = '../node_modules/react-native-permissions/ios'  # pod 'Permission-Camera', :path => "#{permissions_path}/Camera.podspec"  pod 'ReactNativePermissions', :path => '../node_modules/react-native-permissions'  pod 'RNShare', :path => '../node_modules/react-native-share'  pod 'RNSVG', :path => '../node_modules/react-native-svg'  pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'  pod 'react-native-view-shot', :path => '../node_modules/react-native-view-shot'  pod 'AppAuth'  pod 'BugsnagReactNative', :path => '../node_modules/bugsnag-react-native'  pod 'react-native-netinfo', :path => '../node_modules/@react-native-community/netinfo'  pod 'ReactNativeNFC', :path => '../node_modules/react-native-rfid-nfc-scanner/ios'end

And my dependancies inside package.json:

"dependencies": {"@react-native-community/netinfo": "3.2.1","axios": "0.18.0","bugsnag-react-native": "2.23.1","country-list": "2.1.1","formik": "1.5.1","link": "^0.1.5","moment": "2.24.0","react": "16.6.3","react-native": "0.59.9","react-native-android-location-enabler": "^1.1.0","react-native-android-wifi": "0.0.41","react-native-app-auth": "^4.4.0","react-native-camera": "2.1.1","react-native-collapsible": "1.4.0","react-native-country-picker-modal": "0.7.1","react-native-device-info": "2.3.2","react-native-fs": "^2.16.4","react-native-gesture-handler": "1.1.0","react-native-image-picker": "0.28.1","react-native-image-resizer": "^1.2.0","react-native-keep-awake": "^4.0.0","react-native-linear-gradient": "2.5.4","react-native-orientation": "3.1.3","react-native-permissions": "1.1.1","react-native-pinch-zoom-responder": "^0.1.2","react-native-qrcode-scanner": "1.1.2","react-native-rfid-nfc-scanner": "github:avshalomp/react-native-rfid-nfc#fix/nfc_infrastructure","react-native-share": "^3.0.0","react-native-smooth-pincode-input": "1.0.3","react-native-sound": "^0.11.0","react-native-status-bar-height": "2.3.1","react-native-svg": "9.5.1","react-native-svg-charts": "5.2.0","react-native-swipe-gestures": "1.0.3","react-native-swiper": "^1.5.14","react-native-vector-icons": "6.6.0","react-native-view-shot": "^3.1.2","react-native-webview": "^5.7.0","react-native-wifi": "1.0.1","react-navigation": "3.3.2","react-navigation-transitions": "1.0.10","react-redux": "6.0.1","redux": "4.0.1","redux-persist": "5.10.0","redux-saga": "1.0.2","reselect": "4.0.0","styled-components": "4.1.3","yup": "0.26.10"  }

My current env:

   React: 16.6.3,   React Native: 0.59.9 // tested with React Native 0.58.6 too   Xcode: 11.4.1

Really having hard time to debug this one as React Native errors are not so helpful, plus probably missing something

Any Ideas how to get more info about this one?

Or how to solve it?

Help..


Issue rendering local static image in iOS only (React Native)

$
0
0

I'm new to coding and react native, so sorry if this is a stupid question.

I'm having issues rendering a hamburger icon from the following code. It works as expected on Android but not iOS.

import React from 'react';import { StyleSheet, Text, View, TouchableOpacity, Image } from 'react-native';import { totalPoints, totalBucks } from '../datasets/UserData.js';export class Navbar extends React.Component {    constructor(props){        super(props);    }    burgerPress = value => {        this.props.onPress();       }render(){var points = totalPoints;var bucks = totalBucks;    return(<View style={styles.row}><Text style={styles.column} /><Text style={styles.column}><Image source={require('../../assets/coins.png')}  style={{ width: 30, height: 30, resizeMode: 'contain'}}/>                  {""}{ points }</Text> <Text style={styles.column}><Image source={require('../../assets/bills.png')}   style={{ width: 40, height: 40, resizeMode: 'contain'}}/>                 {""}{ bucks }</Text><View style={styles.column}><TouchableOpacity onPress={() => this.burgerPress()} style={{width: 40, height: 40, justifyContent: 'center', alignItems: 'center'}}><Image source={require('../../assets/hamburger.png')} resizeMode={'contain'} style={{ width: 40, height: 40, backgroundColor: 'lightblue', tintColor: '#ffffff',  justifyContent: 'center', alignItems: 'center'}}/> </TouchableOpacity></View></View>        );};};const styles={    row: {        flex: 1,        alignItems: 'flex-end',        flexDirection: 'row',        borderBottomWidth: 1,        borderColor: "#000000",        padding: 5,        justifyContent: 'center'    },    column: {        flex: 1,        alignItems: 'center',        flexDirection: 'column',        justifyContent: 'center'    }}

The coins and bills icons load properly on both platforms. The hamburger loads on android, but on iOS, all I get is the background color. If I delete the backgroundColor and tintColor, it renders nothing, so I think the issue is that it is not importing the image at all but only on iOS. Is there any way to get this to work?

iOS display(unexpected)

Android display(expected)

Disable Screen Capture/ScreenShot in React Native App

$
0
0

I have came across few solutions specific for ios and Android to prevent screen-capturing and taking screenshots. But how do i disable screen-capturing in react native?

Add Resources like Images or Value.plist file from react-native IOS (some react-native command in bonus)

$
0
0

I am adding images and UserResources.plist from podspec file. like this.

s.resources = ['ios/Assets/**/*.png', 'ios/UserResources.plist']

but not getting any resources folder in react-native app after link the module.

ld: library not found for -lRCTAnimation

$
0
0

Description

After react native version upgradiong to 0-62.2, I encountered many problems. This is one of them in the following question:

-- I took this page for reference and edited it https://react-native-community.github.io/upgrade-helper/?from=0.59.3&to=0.62.0

React Native version:

react-native-cli: 2.0.1

react-native: 0.62.2

**Expected Results**clang: error: linker command failed with exit code 1 (use -v to see invocation)ld: library not found for -lRCTAnimationwarning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 6.0, but the range of supported deployment target versions is 8.0 to 13.4.99. (in target 'OpenSSL-Universal' from project 'Pods')** BUILD FAILED **The following build commands failed:        Ld /Users/ibrahimyolbir/Library/Developer/Xcode/DerivedData/DGFonder-fxqthwkcalsxjgaeqbdxsodcnrou/Build/Products/Debug-iphonesimulator/DGFonder.app/DGFonder normal x86_64(1 failure)
**Podfile**platform :ios, '9.0'require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'def flipper_pods()  flipperkit_version = '0.34.0'  pod 'FlipperKit', '~>'+ flipperkit_version, :configuration => 'Debug'  pod 'FlipperKit/FlipperKitLayoutPlugin', '~>'+ flipperkit_version, :configuration => 'Debug'  pod 'FlipperKit/SKIOSNetworkPlugin', '~>'+ flipperkit_version, :configuration => 'Debug'  pod 'FlipperKit/FlipperKitUserDefaultsPlugin', '~>'+ flipperkit_version, :configuration => 'Debug'  pod 'FlipperKit/FlipperKitReactPlugin', '~>'+ flipperkit_version, :configuration => 'Debug'end# Post Install processing for Flipperdef flipper_post_install(installer)  installer.pods_project.targets.each do |target|    if target.name == 'YogaKit'      target.build_configurations.each do |config|        config.build_settings['SWIFT_VERSION'] = '4.1'      end    end  end  file_name = Dir.glob("*.xcodeproj")[0]  app_project = Xcodeproj::Project.open(file_name)  app_project.native_targets.each do |target|    target.build_configurations.each do |config|      cflags = config.build_settings['OTHER_CFLAGS'] || '$(inherited) '      unless cflags.include? '-DFB_SONARKIT_ENABLED=1'        puts 'Adding -DFB_SONARKIT_ENABLED=1 in OTHER_CFLAGS...'        cflags << '-DFB_SONARKIT_ENABLED=1'      end      config.build_settings['OTHER_CFLAGS'] = cflags    end    app_project.save  end  installer.pods_project.saveendtarget 'DGFonder' do  pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"  pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"  pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"  pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"  pod 'React', :path => '../node_modules/react-native/'  pod 'React-Core', :path => '../node_modules/react-native/'  pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'  pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'  pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'  pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'  pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'  pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'  pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'  pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'  pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'  pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'  pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'  pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'  pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'  pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'  pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'  pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'  pod 'ReactCommon/callinvoker', :path => "../node_modules/react-native/ReactCommon"  pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"  pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/Yoga', :modular_headers => true  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'  use_native_modules!  target 'DGFonderTests' do    inherit! :search_paths    # Pods for testing  end  flipper_pods()  post_install do |installer|    flipper_post_install(installer)    installer.pods_project.targets.each do |target|      if target.name == 'react-native-config'        phase = target.project.new(Xcodeproj::Project::Object::PBXShellScriptBuildPhase)        phase.shell_script = "cd ../../"\"&& RNC_ROOT=./node_modules/react-native-config/"\"&& export SYMROOT=$RNC_ROOT/ios/ReactNativeConfig"\"&& export BUILD_DIR=$RNC_ROOT/ios/ReactNativeConfig"\"&& ruby $RNC_ROOT/ios/ReactNativeConfig/BuildDotenvConfig.ruby"        target.build_phases << phase        target.build_phases.move(phase,0)      end    end  endend

ProjectName> Build phases > Link Binary With Libraries

enter image description here

React Native : BLE, Discover & Broadcast (advertise data)

$
0
0

I'm very new to BLE APIs and capabilities. I want to achieve a "simple" thing. Let's say I'm developing the APP-X. I want to be able to scan other phone around me, with APP-X installed (exactly like this app here https://www.tracetogether.gov.sg/ ). I want to scan and filter the wanted devices via a "simple" metadata (advertising data ? specific for my app) within the signal emitted by the concerned phones. I'm stuck because Idk how to "emit" (broadcast) that custom signal.

Can you please help me find a way to do this in RN ?

I have already check those libs:

Many thanks

react-native ios Podfile issue with "use_native_modules!"

$
0
0

In my react-native project (react-native@0.60) in the ios/ dir I run pod install and get this error:

[!] Invalid `Podfile` file: no implicit conversion of nil into String. #  from /Users/coryrobinson/projects/hhs2/ios/Podfile:37 #  ------------------------------------------- #  >    use_native_modules! #  end #  -------------------------------------------

I haven't added or changed anything in this Podfile - it's all react-native generated. (I'm not experienced in iOS dev so this might be a simple fix, I just don't know what to look for :-|) Thanks for any help!

Here is my Podfile

platform :ios, '9.0'require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'target 'hhs2' do  # Pods for hhs2  pod 'React', :path => '../node_modules/react-native/'  pod 'React-Core', :path => '../node_modules/react-native/React'  pod 'React-DevSupport', :path => '../node_modules/react-native/React'  pod 'React-fishhook', :path => '../node_modules/react-native/Libraries/fishhook'  pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'  pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'  pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'  pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'  pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'  pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'  pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'  pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'  pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'  pod 'React-RCTWebSocket', :path => '../node_modules/react-native/Libraries/WebSocket'  pod 'RNFS', :path => '../node_modules/react-native-fs'  pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'  pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'  pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'  pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'  pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'  target 'hhs2Tests' do    inherit! :search_paths    # Pods for testing  end  use_native_modules!endtarget 'hhs2-tvOS' do  # Pods for hhs2-tvOS  target 'hhs2-tvOSTests' do    inherit! :search_paths    # Pods for testing  endend

How to safely run a react-native project in iOS that is working perfectly in android?

$
0
0

I am building a react-native project to track Covid19 cases, it is simple and minimal, which is my first project and I only intend to get data that I want to view.

I have been building it in Windows and I have even generated .apk file which works pretty fine and I have let some of my friends tested it.

Unfortunately, I use iOS and I want to use it for myself. I do own a mac, so I pushed the original file to the github and cloned it in my mac. I have run npm install and pod install, but it just isn't working fine. I have tried two things.

I have tried to run it in the traditional way, running it in the iOS emulator with npx react-native run-ios.

And I have also tried to deploy it into my iPhone by following an article from medium. But it seems like I am doing something not possible. Is it possible to use the same code base and structure for both ios and android? Or what did I miss when I cloned it from the github? I do know many files are being .gitignore'ed.


Fetch image urls from Django with http on ios

$
0
0

I try to fetch images in React Native from my Django Rest Api. The Fetch works and i get all the data in my array, but i missing the image when i open it in expo on my iOS Device.

I have read that http is not allowed on iOS but how can i show my images now in development?

Hope you can help me.

Fetch my data

function getbannerdata(){    return fetch ('http://192.168.178.46:8000/intranet/messages/', {        method: 'GET',        headers: {'Content-Type': 'application/json',        },    })        .then((res) => res.json())        .then((resData) => {            return resData;        })        .catch(error => console.log(error))};export { getbannerdata }

Image component

const BannerItem = ({ item }) => {    console.log({item})    return (<View style={styles.cardView}><Image style={styles.Image} source={{ uri: item.header }} /><View style={styles.textView}><Text style={styles.itemTitle}>{item.title}</Text><Text numberOfLines={2} style={styles.itemDescription}>{item.content}</Text></View></View>    )

info.plist

<dict><key>NSAllowsArbitraryLoads</key><true/><key>NSExceptionDomains</key><dict><key>localhost</key><key>192.168.178.46:8000</key><dict><key>NSExceptionAllowsInsecureHTTPLoads</key><true/></dict></dict></dict>

Why does React Native iOS emulator's reload shortcut sometimes stop working?

$
0
0

Occasionally the Cmd+R keyboard shortcut to reload the React Native iOS emulator stops working. The Cmd+D command to open the developer menu still works, and I can reload from there, and when I close and re-run the emulator Cmd+R works again, but I'm just curious why it might be that it stops working.

Does anyone have any insight?

React-native, iOS simulator stops responding to CMD + D

$
0
0

since a couple of months I'm facing a very strange situation, when developing on the latest versions of react native (0.50+ to 0.60+) the iOS simulator stops responding to keyboard commands, that is:

  • Simulator starts, I can hit Cmd+R or Cmd+D just fine for a few cycles
  • After some hot reload cycles, the commands completely stop working
  • If go to Hardware->Keyboard->Send Keyboard Shortcuts and enabled it, the commands start working again
  • However then the Cmd+Shift+H doesn't work anymore so I cannot easily close the app if I have to

This is really driving me crazy, has anybody faced the same situation or knows any workaround? Many thanks!

P.S. I already tried a few months ago to reset everything (including simulator settings and xcode installation)

Adding border only to the one side of the component in React Native (iOS)

$
0
0

I am facing something weird issue with React-Native's <Text/> component in iOS.

I wanted to apply borderBottomWidth style into <Text/> component but it did NOT work. However, the borderWidth option worked.

  • Worked<Text style={{borderWidth:1}}> React Native </Text>

  • NOT Worked<Text style={{borderBottomWidth:1}}> React Native </Text>


Is there any way to only apply bottom level border into the <Text/> component?

Thank you!


Note:

I am aware of following mentioned approaches in order to achieve this but in my case, I required to apply the style only to the <Text/> component.

  1. We can try wrapping <View/> to the <Text/> and apply borderBottomWidth style to the <View/>. (borderBottomWidth works fine with <View/>)
  2. Adding such <View/> just below to the <Text/> component which can look like a line.

iOS Build Crash after upgrade from 0.60.4 to 0.62.2

$
0
0

I recently upgraded my react-native project from 0.60.4 to 0.62.2. I added all the dependencies and resolved all the errors thrown in terminal one by one and I was successfully able to compile the project. Now when I run the build in XCode the app crashes with following log in XCode:

2020-04-16 16:25:50.635 [error][tid:com.facebook.react.JavaScript] TypeError: undefined is not an object (evaluating 'R.ART.Shape')2020-04-16 16:25:50.641 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: TypeError: undefined is not an object (evaluating 'R.ART.Shape')2020-04-16 16:25:50.642 [error][tid:com.facebook.react.JavaScript] Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)2020-04-16 16:25:50.686677+0530 MY_APP[14817:106507] *** Terminating app due to uncaught exception 'RCTFatalException: Unhandled JS Exception: TypeError: undefined is not an object (evaluating 'R.ART.Shape')', reason: 'Unhandled JS Exception: TypeError: undefined is not an object (evaluating 'R.ART.Shape'), stack:<unknown>@875:258v@2:1473<unknown>@874:228v@2:1473<unknown>@873:242v@2:1473<unknown>@872:150v@2:1473<unknown>@870:228v@2:1473<unknown>@868:342v@2:1473<unknown>@394:471v@2:1473<unknown>@6:70v@2:1473d@2:875global code@1220:3'*** First throw call stack:(    0   CoreFoundation                      0x000000010c4601bb __exceptionPreprocess + 331    1   libobjc.A.dylib                     0x000000010a846735 objc_exception_throw + 48    2   MY_APP                                0x0000000106f0426a RCTFormatError + 0    3   MY_APP                                0x0000000106f876fc -[RCTExceptionsManager reportFatal:stack:exceptionId:suppressRedBox:] + 519    4   MY_APP                                0x0000000106f88197 -[RCTExceptionsManager reportException:] + 1669    5   CoreFoundation                      0x000000010c46703c __invoking___ + 140    6   CoreFoundation                      0x000000010c4644d5 -[NSInvocation invoke] + 325    7   CoreFoundation                      0x000000010c464926 -[NSInvocation invokeWithTarget:] + 54    8   MY_APP                                0x0000000106f36c51 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 612    9   MY_APP                                0x0000000106f39203 _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicE + 251    10  MY_APP                                0x0000000106f38f85 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 78    11  libdispatch.dylib                   0x000000010e367595 _dispatch_call_block_and_release + 12    12  libdispatch.dylib                   0x000000010e368602 _dispatch_client_callout + 8    13  libdispatch.dylib                   0x000000010e36fb0b _dispatch_lane_serial_drain + 791    14  libdispatch.dylib                   0x000000010e370784 _dispatch_lane_invoke + 428    15  libdispatch.dylib                   0x000000010e37a89a _dispatch_workloop_worker_thread + 733    16  libsystem_pthread.dylib             0x000000010e6fd611 _pthread_wqthread + 421    17  libsystem_pthread.dylib             0x000000010e6fd3fd start_wqthread + 13)libc++abi.dylib: terminating with uncaught exception of type NSException

react-native info

System:    OS: macOS Mojave 10.14.6    CPU: (4) x64 Intel(R) Core(TM) i5-5250U CPU @ 1.60GHz    Memory: 317.59 MB / 8.00 GB    Shell: 5.3 - /bin/zsh  Binaries:    Node: 13.13.0 - /usr/local/bin/node    Yarn: Not Found    npm: 6.14.4 - /usr/local/bin/npm    Watchman: 4.9.0 - /usr/local/bin/watchman  Managers:    CocoaPods: 1.7.5 - /usr/local/bin/pod  SDKs:    iOS SDK:      Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1    Android SDK:      API Levels: 23, 24, 26, 28      Build Tools: 28.0.3      System Images: android-28 | Google Play Intel x86 Atom      Android NDK: Not Found  IDEs:    Android Studio: Not Found    Xcode: 10.1/10B61 - /usr/bin/xcodebuild  Languages:    Java: 1.8.0_73 - /usr/bin/javac    Python: 2.7.10 - /usr/bin/python  npmPackages:    @react-native-community/cli: Not Found    react: 16.11.0 => 16.11.0     react-native: 0.62.2 => 0.62.2   npmGlobalPackages:    *react-native*: Not Found

Any help would be highly appreciated.Thanks-in-advance.

Network requests failed with React Native Expo on iOS

$
0
0

There are questions that are related but none of them answered my question so I thought let's ask it myself with some details.

I am working with a React Native build with the Expo SDK. I am using a localhost GraphQL API but it seems that iOS prevents fetching data from http endpoints. According to sources and other related questions, you have to add stuff to your info.plist file in your iOS build.

But since I am using the Expo SDK I don't have my iOS build. According to the docs, you can add a infoPList object to your app.json. This answer suggests that as well.

So I added in my app.js the following but that didn't worked out:

"ios": {"supportsTablet": false,"infoPlist": {"NSAllowsArbitraryLoads": {"NSAllowsArbitraryLoads": true        }    }}

I am still getting the same "Network request failed" error. Does someone know the solution to this without ejecting?

New React-Native Project: Build fails (ios)

$
0
0

I'm using:react-native-cli: 2.0.1react-native: 0.62.2Xcode: 11.3.1

Creating a react-native project (react-native init Project) and starting it withnpx react-native run-ios throws an build error:

The following build commands failed:    CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler    CompileSwift normal x86_64 /Users/sercan/Desktop/Arbeit/Urlaub/rescue/GetAway/ios/Pods/YogaKit/YogaKit/Source/YGLayoutExtensions.swift(2 failures)

I have no clue, why it comes to an build error, to a new created project.If you have any ideas to solve this problem, please let me know.

Thanks in Advance

Edit: Link for full error message: https://docs.google.com/document/d/1o6tj9OrWmH-OZ5rCkYxhQTi-RYH36S5u36zpmBHHY3E/edit?usp=sharing


What are my options for storing data when using React Native? (iOS and Android) [closed]

$
0
0

I am still new in the React Native world, and generally in the mobile/native world as well, and I am finding the documentation a bit lacking when it comes to data persistence.

What are my options for storing data in React Native and the implications of each type? For instance, I see that there is local storage and async storage, but then I also see things like Realm, and I'm confused how all of this would work with an outside database.

I specifically want to know:

  • What are the different options for data persistence?
  • For each, what are the limits of that persistence (i.e., when is the data no longer available)? For example: when closing the application, restarting the phone, etc.
  • For each, are there differences (other than general setup) between implementing in iOS vs Android?
  • How do the options compare for accessing data offline? (or how is offline access typically handled?)
  • Are there any other considerations I should keep in mind?

Thanks for your help!

iOS Video Caching - Manual cache deletion

$
0
0

I have a React Native application which uses React Native Video with iOS caching. I have been working on a method inside RCTVideoCache.m which would manually delete the data of a particular cache key. According to the documentation of SPTPersistentCache, which the video library uses for caching, data can be deleted either by locking/unlocking a file and invoking a wipe or after inspecting the source code of SPTPersistentCache.h with a method named removeDataForKeys.

I have tried both ways, however, unsuccessfully.

In my first try, I am using wipeLockedFiles. I have created a deleteFromCache() method inside RCTVideoCache.m. Since all my video files are unlocked by default, in this method I am trying to lock the file corresponding to my cacheKey and invoke a wipe on all locked files (which would consist of only my target cacheKey file) as it is demonstrated in the documentation. This method looks like:

- (void)deleteFromCache:(NSString *)cacheKey withCallback:(void(^)(BOOL))handler;{  [self.videoCache lockDataForKeys:@[cacheKey] callback:nil queue:nil];  [self.videoCache wipeLockedFiles];  NSLog(@"Size = %@", @(self.videoCache.totalUsedSizeInBytes));  handler(YES);}

The following results in two errors during compilation:

/Users/.../MyApp/node_modules/react-native-video/ios/VideoCaching/RCTVideoCache.m:79:20: error: no visible @interface for 'SPTPersistentCache' declares the selector 'lockDataForKeys:callback:queue:'  [self.videoCache lockDataForKeys:@[cacheKey] callback:nil queue:nil];   ~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/Users/.../MyApp/node_modules/react-native-video/ios/VideoCaching/RCTVideoCache.m:80:20: error: no visible @interface for 'SPTPersistentCache' declares the selector 'wipeLockedFiles'  [self.videoCache wipeLockedFiles];   ~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~

I really have no idea why these selectors are not visible from SPTPersistentCache.

In my second try, I am using removeDataForKeys(). Again, I have created a deleteFromCache() method inside RCTVideoCache.m which looks like this:

- (void)deleteFromCache:(NSString *)cacheKey withCallback:(void(^)(BOOL))handler;{  [self.videoCache removeDataForKeys:@[cacheKey] callback:^(SPTPersistentCacheResponse * _Nonnull response) {    NSLog(@"Result output: %@", response.output);    NSLog(@"Error output: %@", [response.error localizedDescription]);   } onQueue:dispatch_get_main_queue()];  NSLog(@"Size = %@", @(self.videoCache.totalUsedSizeInBytes));  handler(YES);}

In this second way, there are no errors, however, the data of the key is never deleted. Also, both NSLogs for the response output null inside the terminal.

I am 100% sure that the cacheKey I am providing to my deleteFromCache() method is correct and data corresponding to it exists. However, in both methods NSLog(@"Size = %@", @(self.videoCache.totalUsedSizeInBytes)); does not change and I can also manually verify that the file has not been deleted.

I am really stuck and do not know what is wrong with the code I've written in both cases and why neither of them works. I would appreciate any help on this!

Undetermined permissions on expo notifications

$
0
0

Im building an app on EXPO and react native, and im trying to configure notifications.Im trying on the expo app on an actual iphone, and i get "undetermined" permissions.

enter image description here

Getting build error after linking fonts and running npm run ios

$
0
0

I was trying to link fonts in my project. What I did was after copying the fonts in my assets/fonts folder, I followed the instructions as here

But after linking when I ran, npm run ios --clear--cache, I got an error:

Multiple commands produce '/Users/vibhorgoyal/Library/Developer/Xcode/DerivedData/premierApp-hfvopumdujembydyabljpmaxyrpx/Build/Products/Debug-iphonesimulator/premierApp.app/Zocial.ttf':    1) Target 'premierApp' (project 'premierApp') has copy command from '/Users/vibhorgoyal/Workspace/WebstormProjects/premierApp/node_modules/react-native-vector-icons/Fonts/Zocial.ttf' to '/Users/vibhorgoyal/Library/Developer/Xcode/DerivedData/premierApp-hfvopumdujembydyabljpmaxyrpx/Build/Products/Debug-iphonesimulator/premierApp.app/Zocial.ttf'    2) That command depends on command in Target 'premierApp' (project 'premierApp'): script phase “[CP] Copy Pods Resources”

Please help me identifying the issue.

dyld: Library not loaded: @rpath/CommonLibrary.framework/CommonLibrary

$
0
0

Getting the following error while trying to run iOS app on Device. But works fine on Simulator:

dyld: Library not loaded: @rpath/CommonLibrary.framework/CommonLibrary  Referenced from: /private/var/containers/Bundle/Application/1567263D-A722-4FE9-ABD0-7EC32499DBF0/CureFit.app/Frameworks/Ligero.framework/Ligero  Reason: no suitable image found.  Did find:    /private/var/containers/Bundle/Application/1567263D-A722-4FE9-ABD0-7EC32499DBF0/CureFit.app/Frameworks/CommonLibrary.framework/CommonLibrary: no matching architecture in universal wrapper    /private/var/containers/Bundle/Application/1567263D-A722-4FE9-ABD0-7EC32499DBF0/CureFit.app/Frameworks/CommonLibrary.framework/CommonLibrary: no matching architecture in universal wrapper    /private/var/containers/Bundle/Application/1567263D-A722-4FE9-ABD0-7EC32499DBF0/CureFit.app/Frameworks/CommonLibrary.framework/CommonLibrary: no matching architecture in universal wrapper    /private/var/containers/Bundle/Application/1567263D-A722-4FE9-ABD0-7EC32499DBF0/CureFit.app/Frameworks/CommonLibrary.framework/CommonLibrary: no matching architecture in universal wrapper    /private/var/containers/Bundle/Application/1567263D-A722-4FE9-ABD0-7EC32499DBF0/CureFit.app/Frameworks/CommonLibrary.framework/CommonLibrary: no matching architecture in universal wrapper(lldb) 

I'm new to this. It's a react native project. Can anyone help? Thanks :)

Viewing all 16548 articles
Browse latest View live