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

React-Native Image is not displaying after XCode 11.5 Upgrade

$
0
0

I usually display images like this:

<Image source={require('../../assets/images/color/stuff.png')} /><Image source={require('../some-other-path/picture.png')} />

In the past, I could have any arbitrary path I want, in any folder.

Then, when I build for release, I do this before I Build > Run:

react-native bundle --platform ios --dev false --entry-file index.js --bundle-output ./ios/main.jsbundle

Since upgrading to XCode, whenever I do a release build, my images no longer appear. In dev build, the images are visible.

I have tried --assets-dest ./some-folder, but the results are same.

What could cause this change?


3D Virtual Tour engine for React Native [closed]

$
0
0

I'm looking for an engine/framework to accomplish something like this https://www.iteleport.com.br/tour3d/mvituzzo-maranata-planta-soberana-75-m%C2%B2/ , a virtual 3D tour inside an apartment. Something for React Native would be perfect, because I need to implement it for Android and iOS. But it also can be for native apps (one for iOS and another for Android).

I found lots of libraries to show 3D pictures and AR, but nothing for 3D models. Any idea what I use for it?

React Native v0.62 upgrade increase iOS .ipa size

$
0
0

I recently upgraded from RN v0.60.5 to RN v0.62.2 and I noticed that my iOS builds are now producing an .ipa file nearly triple in size, from ~50MB to 130MB. I can't seem to find any reason for this. I'm guessing it has something to do with Flipper, but I have no evidence of this - simply a guess. I do have several images and fonts that I can probably be removed to decrease the overall size, but regardless, why would my builds produce such a huge increase in size? I can't seem to find any reason for this.

How to load a database to a user app in react native

$
0
0

I am building an app that shows quotes and small texts to an user daily and I am already using async storage to store user preferences. Though I need a way to store these hundreds of quotes too. As well as recall one every day for the notification and everytime the user asks for a new one. I could just write it all on an object in the code in a file for it and import everywhere I need it but that doesn't sound like a good option or load it all in async to be recovered when needed like my user preferences. But I can't tell yet which since I am new to RN.

IOS app crashes: Termination Reason: Namespace SPRINGBOARD, Code 0x8badf00d

$
0
0

I am facing an issue while I am returning after some time in the App, can anyone help me in this regard?

Please find the below crash log.

I did some research regarding this issue & I found some questions in StackOverflow and GitHub, but as I am pretty new in React Native/App development I am unable to figure out the way and steps to resolve the issue.

Crash log

Date/Time:           2020-06-03 21:50:48.8370 +0400Launch Time:         2020-06-03 21:50:22.7923 +0400OS Version:          iPhone OS 13.4.1 (17E262)Release Type:        UserBaseband Version:    7.51.01Report Version:      104Exception Type:  EXC_CRASH (SIGKILL)Exception Codes: 0x0000000000000000, 0x0000000000000000Exception Note:  EXC_CORPSE_NOTIFYTermination Reason: Namespace SPRINGBOARD, Code 0x8badf00dTermination Description: SPRINGBOARD, process-exit watchdog transgression: application<com.bankonus>:5046 exhausted real (wall clock) time allowance of 5.00 seconds | ProcessVisibility: Foreground | ProcessState: Running | WatchdogEvent: process-exit | WatchdogVisibility: Foreground | WatchdogCPUStatistics: ( | "Elapsed total CPU time (seconds): 1.840 (user 1.840, system 0.000), 18% CPU", | "Elapsed application CPU time (seconds): 0.002, 0% CPU" | )Triggered by Thread:  0Thread 0 name:  Dispatch queue: com.apple.main-threadThread 0 Crashed:0   libsystem_kernel.dylib          0x0000000192f7e77c 0x192f58000 + 1575641   libdispatch.dylib               0x0000000192df50a8 0x192df3000 + 83602   libdispatch.dylib               0x0000000192df4fe8 0x192df3000 + 81683   bankonus                        0x0000000104331b2c 0x1041b0000 + 15798204   bankonus                        0x0000000104373990 0x1041b0000 + 18497445   bankonus                        0x00000001043738f0 0x1041b0000 + 18495846   bankonus                        0x0000000104371d80 0x1041b0000 + 1842560

Symbolicated crash log:

Exception Type:  EXC_CRASH (SIGABRT)Exception Codes: 0x0000000000000000, 0x0000000000000000Exception Note:  EXC_CORPSE_NOTIFYTriggered by Thread:  3Last Exception Backtrace:0   CoreFoundation                  0x193e945f0 __exceptionPreprocess + 2241   libobjc.A.dylib                 0x193bb6bcc objc_exception_throw + 552   CoreFoundation                  0x193d98ea8 -[NSObject+ 192168 (NSObject) doesNotRecognizeSelector:] + 1393   CoreFoundation                  0x193e98694 ___forwarding___ + 13154   CoreFoundation                  0x193e9a5bc _CF_forwarding_prep_0 + 915   bankonus                        0x102cbd968 0x102ba0000 + 11697686   bankonus                        0x102cbe120 0x102ba0000 + 11717447   CoreFoundation                  0x193e9a760 __invoking___ + 1438   CoreFoundation                  0x193d6bb40 -[NSInvocation invoke] + 2999   CoreFoundation                  0x193d6c718 -[NSInvocation invokeWithTarget:] + 7510  bankonus                        0x102cef840 0x102ba0000 + 137427211  bankonus                        0x102cf1950 0x102ba0000 + 138273612  bankonus                        0x102cf16b4 0x102ba0000 + 138206813  libdispatch.dylib               0x193b599a8 _dispatch_call_block_and_release + 2314  libdispatch.dylib               0x193b5a524 _dispatch_client_callout + 1515  libdispatch.dylib               0x193b068a4 _dispatch_lane_serial_drain$VARIANT$mp + 60716  libdispatch.dylib               0x193b07294 _dispatch_lane_invoke$VARIANT$mp + 41517  libdispatch.dylib               0x193b1078c _dispatch_workloop_worker_thread + 58718  libsystem_pthread.dylib         0x193babb74 _pthread_wqthread + 27119  libsystem_pthread.dylib         0x193bae740 start_wqthread + 7

Unable to install custom expo client for iOS

$
0
0

I am trying to get my React-Native app to run on my iPhone. It uses the expo background location service, and as such I need to use a custom iOS expo client to run the app on my iPhone (as suggested here). I am following this tutorial to install a custom iOS expo client on an iPhone. I have already created the device I want this custom expo client to be installed on in my Apple Developer console. I am running Windows 10 version 1809 on my development computer.

The process works smoothly until I need to select whether I would like to register a new device. I select No (n) as my device is already listed, and I get the error:

? Would you like to register a new device to use the Expo client with? NoUnable to fetch manifest from: https://exp.host/@exponent/home.

Here is a screenshot of the process:

expo client:ios

I have also tried entering Yes (Y) and the process works fine until I try to install the profile on my iPhone when I get the message:

Waiting for user to register their device for development

iPhone expo notification

Despite the message's implication that an email will arrive detailing the directions to register for UDID (presumably to my expo account email), an email never arrives.

I would expect that when I enter No (n) I should get a link and/or QR code to install the client on my device.

I am certain others have also set up a custom expo client for iOS. What could I possibly be doing wrong?

How to generate protocol buffers for iOS release/production build React Native

$
0
0

The title says it all.

On Android dev & release build everything works fine. In development mode on iOS they're generated fine using the following command:

protoc -I=proto/ proto/**/*.proto \--js_out=import_style=commonjs:src/ \--grpc-web_out=import_style=commonjs,mode=grpcwebtext:src/

However, on iOS in release/production configuration, the protocol buffers aren't generated so none of our requests are successful, they hang.

We're using React Native but archive using XCode.

I've looked at the official documentation but there a solution doesn't immediately jump out to me.

Thank you in advance~!

How to save json data displayed on simulator to local storage (React-native)

$
0
0

I am using react-native and expo. I have two screen. When user clicks on first screen symbol such as

First screen:

AacompanyBbcompany

User clicks on A symbol. I fetch some json data for that symbol and display on my second screen, but I want that fetched data to be saved on the second screen. But right now if I go back to first screen(it has some json data such as symbol name A and what it stands for acompany etc as given above) and come back to second screen the data get disappeared. Is there any way to store my data of second screen to the local storage? I have comment the line in second class that I would like to store in local storage

My second class:

import React, { useState, useEffect } from "react";import {  TouchableWithoutFeedback,  Keyboard,  FlatList,  TextInput,  Button,  Text,} from "react-native";import {  StyleSheet,  View } from "react-native";import { useStocksContext } from "../contexts/StocksContext";import { scaleSize } from "../constants/Layout";export default function StocksScreen({ route }) {  const { ServerURL, watchList } = useStocksContext();  const [state, setState] = useState({    myListData: [],  });  const { stuff } = route.params;  renderWithData = () => {    return fetch(`http://131.181.190.87:3001/history?symbol=${stuff}`)      .then((res) => res.json())      .then((json) => {        setState({          isLoaded: true,          myListData: json,        });      });  };  useEffect(() => {    renderWithData();  }, [watchList]);  let item = state.myListData.length && state.myListData[0]; //that's the data I would like to save on local storage (movie) let movie = (<View  style={styles.text}><Text style={styles.text} key={item.symbol}>      {item.high}</Text><Text style={styles.text} key={item.symbol}>      {item.close}</Text></View>)  return (<TouchableWithoutFeedback onPress={Keyboard.dismiss}><View style={styles.container}><Text style={styles.text}>bb</Text><View>{movie}</View></View></TouchableWithoutFeedback>   );}const styles = StyleSheet.create({  text: {    color: "black",    backgroundColor: "white",  },});

Third class: Here I would like to save my data to local storage

import React, { useState, useContext, useEffect } from "react";import { AsyncStorage } from "react-native";const StocksContext = React.createContext();export const StocksProvider = ({})  const [state, setState] = useState([]);  return (<StocksContext.Provider value={[state, setState]}></StocksContext.Provider>  );}}

How can I store my second screen data to the local storage? Is there any way to do that? I have never done this before such as storing data locally. I even went through a couple tutorials and looked online, but couldn't figure out. Any help is appreciated.


iOS not receiving pending APNs push notification after turn on device or Internet again

$
0
0

I am developing an iOS chat app using react-native. Enabled remote notification capability. Notifications are received when the app is connected with network. Once I switched off the mobile and switching it on after a night, the pending notifications are not received. Any idea of why it is not receiving?

My notification payload will looks like,

pn_apns: {      aps: {         alert: {"title": "test", body: "hello"},         sound: "default",         content-available: 1       }    }

How to pass my json data to another class

$
0
0

I have two screen. On one I have some json data listed as:

AacompanyBbcompany

When user clicks on A the value A get passed to second class and I use that data to fetch some json data related to it and display on second screen. I want to save that fetched data on second screen to local storage.

I want to save data to this class:

import React, { useState, useContext, useEffect } from "react";import { AsyncStorage } from "react-native";const StocksContext = React.createContext();export const StocksProvider = ({ children }) => {  const [state, setState] = useState([]);  return (<StocksContext.Provider value={[state, setState]}>      {children}</StocksContext.Provider>  );};export const useStocksContext = () => {  const [state, setState] = useContext(StocksContext);  // can put more code here  function addToWatchlist(newSymbol) {    //FixMe: add the new symbol to the watchlist, save it in useStockContext state and persist to AsyncStorage  }  useEffect(() => {    // FixMe: Retrieve watchlist from persistent storage  }, []);  return { ServerURL: 'http://131.181.190.87:3001', watchList: state,  addToWatchlist };};

This is my second screen class:

import React, { useState, useEffect } from "react";import {  TouchableWithoutFeedback,  Keyboard,  FlatList,  TextInput,  Button,  Text,} from "react-native";import {  StyleSheet,  View /* include other react-native components here as needed */,} from "react-native";import { useStocksContext } from "../contexts/StocksContext";import { scaleSize } from "../constants/Layout";// FixMe: implement other components and functions used in StocksScreen here (don't just put all the JSX in StocksScreen below)export default function StocksScreen({ route }) {  const { ServerURL, watchList } = useStocksContext();  const [state, setState] = useState({    myListData: [],    gretting:"",    /* FixMe: initial state here */  });  const { stuff } = route.params;  renderWithData = () => {    return fetch(`http://131.181.190.87:3001/history?symbol=${stuff}`)      .then((res) => res.json())      .then((json) => {        setState({          isLoaded: true,          myListData: json,        });      // console.log(state.myListData[0]);      });  };  useEffect(() => {    renderWithData();    // FixMe: fetch stock data from the server for any new symbols added to the watchlist and save in local StocksScreen state  }, [watchList]);  //let item = state.myListData[0];  let item = state.myListData.length && state.myListData[0]; //this is displayed on second screen and I want to save this data even when user goes back to first screen and comes back to second screen again let movie = ( <View  style={styles.text}><Text style={styles.text} key={item.symbol}>      {item.high}</Text><Text style={styles.text} key={item.symbol}>      {item.close}</Text><Text>{state.gretting}</Text><Text>yooo</Text></View>)let printme =(   console.log("yes"),   route("useStocksContext", { stuff: movie }))  return (<TouchableWithoutFeedback onPress={Keyboard.dismiss}><View style={styles.container}><Text style={styles.text}>bb</Text><View>{movie}</View><Text style={styles.text} onPress={printme}>press me</Text> //passing data</View></TouchableWithoutFeedback>   );}const styles = StyleSheet.create({  text: {    color: "black",    backgroundColor: "white",  },});

I am assuming I need to send the data that I want to save on second screen to my another class (where I will perform all the saving of data). I am trying to pass my movies to another class as everything inside it is displayed on second screen and that's what I am trying to save on local storage so the data is still there on second screen even if user goes to first screen and comes back to second screen using navigator at the bottom of the screen.

 let printme =(       console.log("yes"),       route("useStocksContext", { stuff: movie })    )

in return method:

<Text style={styles.text} onPress={printme}>press me</Text> //passing data 

Although I have it inside text field I need to just send the data once the screen refresh or user goes to another scree, but I am not sure how to do that. Also, when I use printMe() to pass the data nothing works. How can I pass my data to another class and save it to local storage?

How do I style my json data on screen in form of table?

$
0
0

I have a screen where my data is displayed. I want to display in the form of table (The data at the bottom of screen)as shown below in screenshot.

Right now my screen looks like:

myscreen

I want it to look like this:

image

The data next to the close, high etc is some json data that I fetched from api.

My class:

let movie = ( <View  style={styles.bottomdata}><Text style={styles.text} key={item.name}>      {item.name}</Text><Text style={styles.text} key={item.open}>      OPEN {item.open}</Text><Text style={styles.text} key={item.close}>      CLOSE{item.close}</Text><Text style={styles.text} key={item.volumes}>      VOLUME{item.volumes}</Text><Text style={styles.text} key={item.low}>     LOW {item.low}</Text><Text style={styles.text} key={item.high}>      HIGH{item.high}</Text></View>)  return (<TouchableWithoutFeedback onPress={Keyboard.dismiss}><View style={styles.container}><View>{movie}</View></View></TouchableWithoutFeedback>   );}const styles = StyleSheet.create({  text: {    color: "black",    backgroundColor: "white",  },  bottomdata:  {      marginTop:400,      backgroundColor:"black",  }});

The movie is the data displayed on the screen. How do I design it like that? And, at the top it is just the symbol name (same as at the bottom) and close and high values. How can I design my screen like that? I am able to fetch the data but not sure how to design it like that.

TypeError: null is not an object (evaluating 'Chat.addListener')

$
0
0

I have a react native project that was working fine both on android and iOS.I added the calling and chat service to my project using the package 'react-native-quickblox-sdk v0.5.2-beta' afterwards.

It works perfectly fine on android, but when I run it on iOS, after loading all the bundles, just before opening the app, it brings up an error.

TypeError: null is not an object (evaluating 'Chat.addListener').Here's the image of the error.Error screen

my podFile:

plugin 'cocoapods-fix-react-native'platform :ios, '10.0'require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'pod 'Firebase/Core', '~> 6.15.0'pod 'Firebase/Messaging'target 'myApp' dopermissions_path = '../node_modules/react-native-permissions/ios'  # Pods for myApp  pod 'QuickBlox'  pod 'Quickblox-WebRTC'  pod 'RNPermissions', :path => '../node_modules/react-native-permissions'  pod 'Permission-Camera', :path => "#{permissions_path}/Camera.podspec"  pod 'Permission-Microphone', :path => "#{permissions_path}/Microphone.podspec"  pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'  pod 'React', :path => '../node_modules/react-native/'  pod 'React-Core', :path => '../node_modules/react-native/'  pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'  pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'  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 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"  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 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon"  pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"  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', :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'  pod 'CodePush', :path => '../node_modules/react-native-code-push'  pod 'ReactNativeExceptionHandler', :podspec => '../node_modules/react-native-exception-handler/ReactNativeExceptionHandler.podspec'  # pod 'RNFirebase', :path => '../node_modules/react-native-firebase/ios'  pod 'RNCAsyncStorage', :path => '../node_modules/@react-native-community/async-storage'  # pod 'RNGestureHandler', :podspec => '../node_modules/react-native-gesture-handler/RNGestureHandler.podspec'  pod 'react-native-video', :path => '../node_modules/react-native-video/react-native-video.podspec'  pod 'RNDeviceInfo', :path => '../node_modules/react-native-device-info'  pod 'RNGestureHandler', :path => '../node_modules/react-native-gesture-handler'  pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'  pod 'react-native-orientation-locker', :path => '../node_modules/react-native-orientation-locker'  pod 'RNBootSplash', :path => '../node_modules/react-native-bootsplash'  pod 'lottie-react-native', :path => '../node_modules/lottie-react-native'  pod 'lottie-ios', :path => '../node_modules/lottie-ios'  # pod 'RNCPushNotificationIOS', :path => '../node_modules/@react-native-community/push-notification-ios'end

I added and deleted lots of stuff (such as the quickblox pods on the top) and also I changed some codes in 'node_modules/quickblox-react-native-sdk' to get it to work but the problem persists.

In the address: {PROJECT_DIRECTORY}/node_modules/quickblox-react-native-sdk/index.js there is an object that it seems it returns null or undefined. here's the code.

the sdk code

changing Chat.addListener to Chat && Chat.addListener throws another TypeError with this title: ..... (evaluating 'Chat.removeEventListeners') and so on..

Any helps or solutions will be really appreciated.

“launchPackager.command” cannot be opened because it is from an unidentified developer

$
0
0
macOS Catalina 10.15

app not run in ios:- show me this warning.

enter image description here

What is the difference between react-native cli and Expo with Bare workflow?

$
0
0

I am going to build a very big application with multiple complex functionalities. but I am stuck on bellow points -

  1. What is the difference between react-native cli and Expo with Bare workflow?
  2. what Should I include in my project and why?
  3. is expo created by facebook?

using sys root for 'iPhoneSimulator' but targeting 'MacOSX' warning in NPM install

$
0
0

For some reason I'm not able to do NPM install on my project anymore since I'm getting the following messages:

  SOLINK_MODULE(target) Release/.nodeclang: warning: using sysroot for 'iPhoneSimulator' but targeting 'MacOSX' [-Wincompatible-sysroot]ld: warning: building for macOS, but linking in .tbd file (/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/usr/lib/libc++.tbd) built for iOS Simulatorld: warning: building for macOS, but linking in .tbd file (/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk/usr/lib/libSystem.tbd) built for iOS Simulatorld: warning: building for macOS, but linking in .tbd file (/usr/lib/system/libcache.dylib) built for iOS Simulatorld: warning: building for macOS, but linking in .tbd file (/usr/lib/system/libcommonCrypto.dylib) built for iOS Simulatorld: warning: building for macOS, but linking in .tbd file (/usr/lib/system/libcompiler_rt.dylib) built for iOS Simulatorld: warning: building for macOS, but linking in .tbd file (/usr/lib/system/libcopyfile.dylib) built for iOS Simulatorld: warning: bui

How to fix this???? I have tried uninstalling node and reinstalling node but I'm still getting the same error.


attach a file from a mobile app to an e-mail

$
0
0

In my mobile app, I need to figure out a way to take a file and attach it to an e-mail. This app shows it's possible - about half way down the page is their documentation to show users how (see section called "iOS & Android: Sending a file"). I looked up sending attachments using mailto and quickly found out that's not possible. This app is built using Expo, Vue Native and some React Native. How can this be achieved?

React Native only for UI components

$
0
0

I have a very simple ViewController written in Swift with its UI built in Storyboard. It simply changes the text of a label when someone presses a button.

class ViewController: UIViewController {    @IBOutlet weak var label: UILabel!    @IBAction func changeText() {        switch label.text! {            case "Old Text":                label.text = "New Text"            case "New Text":                label.text = "Old Text"            default:                break        }    }}

I want to use React Native for my project but only to handle the UI components, not the app logic itself. How would I go about this? I have laid out the button and the text with react.

var Button = require('react-native-button');class TestProject extends Component {  render() {    return (<View style={styles.container}><Button style={styles.button}>Change Text</Button><Text style={styles.text}>          Text to be changed</Text></View>    );  }}const styles = StyleSheet.create({  container: {    flex: 1,    justifyContent: 'center',    alignItems: 'center',    backgroundColor: '#F5FCFF',  },  text: {    fontSize: 20,    textAlign: 'center',    margin: 10,  },  button: {    borderWidth: 1,    borderColor: 'blue'  },});

More broadly speaking, if what I want is possible, is it still feasible to use this approach for more powerful and robust applications?

Problem with the modal permisions in ios with React-native and expo

$
0
0

i have a problem when i try set the modal permissions in ios for into to the camera or galery. This modal is quicky and i cant toch allow the permisions. Is work in Android but in IOS no working. I use expo and the fisical device. Any help?

Background processing being killed after seconds when minimizing a IOS app

$
0
0

Introduction

I made a VOIP dialer app with react-native. I'm using react-native-callkeep to show the user the default IOS call screen when receiving a call (On background and foreground), and i'm using react-native-push-notification to pop-up a local notification when a call is received too.

The problem

When i minimize the app (With the home button) and the app receives a call, he doesn't show neither the local notification or the call screen.but, if the call comes right after the minimize action, the screen and the notification shows up.

Tecnical explanation of what happens

Reading the logs, i see that IOS kills my app background processing when he prints the following line:

15:08:23.085311-0300 symptomsd com.vmaxtelecom.vmaxfone: Foreground: false

After this, nothing works on foreground neither background

Code explanation

Probably, the problem isn't with react-native-callkeep or with react-native-push-notification itself (Because they're work as intended). I think it's something with IOS Itself.

I found this thread wich defines exactly what happens to me.

My enabled capabilities

enter image description here

What i'm using

react-native version 0.61.5

Xcode version 11.5 (11E608c) on a MacOS 10.15.5 Catalina

IOS 13.4.1 on a Iphone 8

I'm using a release version of my project (The debug version does the same thing too)

My AppDelegate.m (Only the part after didFinishLaunchingWithOptions matters the most)

#import "AppDelegate.h"#import <React/RCTBridge.h>#import <React/RCTBundleURLProvider.h>#import <React/RCTRootView.h>#import <UserNotifications/UserNotifications.h>#import <RNCPushNotificationIOS.h>#import "RNCallKeep.h"#if DEBUG#import <FlipperKit/FlipperClient.h>#import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>#import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>#import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>#import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>#import <FlipperKitReactPlugin/FlipperKitReactPlugin.h>static void InitializeFlipper(UIApplication *application) {  FlipperClient *client = [FlipperClient sharedClient];  SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];  [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]];  [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]];  [client addPlugin:[FlipperKitReactPlugin new]];  [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];  [client start];}#endif@implementation AppDelegate- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{if ([UIApplication instancesRespondToSelector:@selector(registerUserNotificationSettings:)]){    [application registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound categories:nil]];}#if DEBUG  InitializeFlipper(application);#endif  RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];  RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge                                                   moduleName:@"VMAXFone"                                            initialProperties:nil];  rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];  UIViewController *rootViewController = [UIViewController new];  rootViewController.view = rootView;  self.window.rootViewController = rootViewController;  [self.window makeKeyAndVisible];  UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];  center.delegate = self;  return YES;}-(void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler{  completionHandler(UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionBadge);}- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge{#if DEBUG  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];#else  return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];#endif}- (BOOL)application:(UIApplication *)applicationcontinueUserActivity:(NSUserActivity *)userActivity  restorationHandler:(void(^)(NSArray * __nullable restorableObjects))restorationHandler{  return [RNCallKeep application:application           continueUserActivity:userActivity             restorationHandler:restorationHandler];}- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings{ [RNCPushNotificationIOS didRegisterUserNotificationSettings:notificationSettings];}- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{ [RNCPushNotificationIOS didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];}- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfofetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler{  [RNCPushNotificationIOS didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];}- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error{ [RNCPushNotificationIOS didFailToRegisterForRemoteNotificationsWithError:error];}- (void)userNotificationCenter:(UNUserNotificationCenter *)centerdidReceiveNotificationResponse:(UNNotificationResponse *)response         withCompletionHandler:(void (^)(void))completionHandler{  [RNCPushNotificationIOS didReceiveNotificationResponse:response];  completionHandler();}- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification{ [RNCPushNotificationIOS didReceiveLocalNotification:notification];}@end

i dont think this is necessary but every information counts, so here's how i set-up react-native-callkeep (This function is called whe the app starts)

function initCallKitIntegration() {  return async function (dispatch, getState) {    let activeCall = null    const uuids = {}    const options = {      ios: {        appName: 'VMAX Fone',        imageName: 'phone_account_icon',        includesCallsInRecents: true,        supportsVideo: false      }    }    RNCallKeep.setup(options).then(accepted => {})    let incomingCall = null    const {endpoint} = getState().pjsip    const {appState} = getState().pjsip    endpoint.on("call_received", (call) => {      RNCallKeep.addEventListener('answerCall', () => {        //accept call here      })      RNCallKeep.addEventListener('endCall', () => {        //decline call here      })      RNCallKeep.addEventListener('didPerformDTMFAction', ({ digits, callUUID }) => {        //send dtmf digits here      })      RNCallKeep.addEventListener('didPerformSetMutedCallAction', ({ muted, callUUID }) => {        //mute and unmute call here      })      RNCallKeep.addEventListener('didToggleHoldCallAction', ({ hold, callUUID }) => {        //hold and unhold call here      })      endpoint.on("call_changed", (call) => {        //Change Call state here      })      endpoint.on("call_terminated", (call) => {        //endCall here        RNCallKeep.endCall(uuids[call.getCallId()])        delete uuids[call.getCallId()]      })      if (appState != 'active'){        RNCallKeep.displayIncomingCall(uuids[call.getCallId()], call.getRemoteNumber(), call.getRemoteNumber(), 'number', false)      }    })  }}

The logs

15:08:22 VMAXFone   Snapshotting a view (0x107269800, UIKeyboardImpl) that has not been rendered at least once requires afterScreenUpdates:YES.15:08:22 powerd Process runningboardd.28 Created SystemIsActive "application<com.vmaxtelecom.vmaxfone>28-56-1455:FBSceneSnapshotAction:sceneID:com.vmaxtelecom.vmaxfone-default" age:00:00:00  id:51539643472 [System: PrevIdle SysAct]15:08:22 SpringBoard    [sceneID:com.vmaxtelecom.vmaxfone-default] Sending scene action [SceneLifecycleEventOnly][0xa901] through WorkspaceServer: 0x2819e430015:08:22 backboardd Lcurrent=258.9457 Lr=2.8323 DR=91.4263 factor=0.084515:08:23 SpringBoard    Application process state changed for com.vmaxtelecom.vmaxfone: <SBApplicationProcessState: 0x280321380; pid: 476; taskState: Running; visibility: Background>15:08:23 SpringBoard    [com.vmaxtelecom.vmaxfone] Generating image data for snapshot: <XBApplicationSnapshot: 0x10033e300; identifier: 5EA00F96-F22F-4CDA-907D-4E24FCC9119C; contentType: SceneContent>15:08:23 backboardd Lcurrent=258.9457 Lr=2.8347 DR=91.3501 factor=0.084615:08:23 backboardd Lcurrent=258.9457 Lr=2.8370 DR=91.2738 factor=0.084715:08:23 SpringBoard    [com.vmaxtelecom.vmaxfone] Generating image data for snapshot: <XBApplicationSnapshot: 0x107662e60; identifier: DAA57ADA-4C38-4904-9139-C0782D20A8CA; variantID: downscaled; 15:08:23 SpringBoard    [com.vmaxtelecom.vmaxfone] Snapshot data for <XBApplicationSnapshot: 0x10033e300; …4E24FCC9119C> written to file: /private/var/mobile/Containers/Data/Application/E4F918EF-7431-4A05-9845-344EB8B058DD/Library/SplashBoard/Snapshots/sceneID:com.vmaxtelecom.vmaxfone-default/5EA00F96-F22F-4CDA-907D-4E24FCC9119C@2x.ktx15:08:23 backboardd Lcurrent=258.9457 Lr=2.8394 DR=91.1976 factor=0.084815:08:23 powerlogHelperd    {"msg":"CLCopyAppsUsingLocation", "event":"activity"}15:08:23 SpringBoard    [com.vmaxtelecom.vmaxfone] Snapshot data for <XBApplicationSnapshot: 0x107662e60; …C0782D20A8CA> written to file: /private/var/mobile/Containers/Data/Application/E4F918EF-7431-4A05-9845-344EB8B058DD/Library/SplashBoard/Snapshots/sceneID:com.vmaxtelecom.vmaxfone-default/downscaled/DAA57ADA-4C38-4904-9139-C0782D20A8CA@2x.ktx15:08:23 backboardd Lcurrent=258.9457 Lr=2.8418 DR=91.1215 factor=0.084915:08:23 backboardd Lcurrent=258.9457 Lr=2.8441 DR=91.0455 factor=0.085015:08:23 kernel memorystatus: set assertion priority(3) target VMAXFone:47615:08:23 runningboardd  [application<com.vmaxtelecom.vmaxfone>:476] Set jetsam priority to 3 [0] flag[1]15:08:23 runningboardd  [daemon<com.apple.SpringBoard>:56] Ignoring jetsam update because this process is not memory-managed15:08:23 runningboardd  Calculated state for application<com.vmaxtelecom.vmaxfone>: running-active (role: NonUserInteractive)15:08:23 runningboardd  [application<com.vmaxtelecom.vmaxfone>:476] Set darwin role to: NonUserInteractive15:08:23 runningboardd  [daemon<com.apple.SpringBoard>:56] Ignoring GPU update because this process is not GPU managed15:08:23 runningboardd  Calculated state for daemon<com.apple.SpringBoard>: running-active (role: UserInteractiveNonFocal)15:08:23 backboardd Lcurrent=258.9457 Lr=2.8465 DR=90.9694 factor=0.085115:08:23 mediaserverd   -CMSessionMgr- CMSessionMgrHandleApplicationStateChange: CMSession: Client com.vmaxtelecom.vmaxfone with pid '476' is now Background Running. Background entitlement: YES ActiveLongFormVideoSession: NO WhitelistedLongFormVideoApp NO15:08:23 mediaserverd   AudioSessionServerImp.cpp:3517:HandleAudioSessionApplicationStateChangeListener: { "action":"application_state_changed", "session":{"ID":"0x1f672","PID":476,"name":"VMAXFone"}, "details":{"new_state":"Background Running"} }15:08:23 mediaserverd   -CMSessionMgr- CMSessionMgrHandleApplicationStateChange: CMSession: Client (null) with pid '477' is now Background Running. Background entitlement: NO ActiveLongFormVideoSession: NO WhitelistedLongFormVideoApp NO15:08:23 mediaserverd   -CMSessionMgr- CMSessionMgrHandleApplicationStateChange: CMSession: Sending stop command to (null) with pid '477' because client is not allowed to play in the background AND does not continue AirPlaying video when device locks15:08:23 mediaserverd   -CMSessionMgr- CMSessionMgrHandleApplicationStateChange: CMSession: Client (null) with pid '405' is now Background Running. Background entitlement: YES ActiveLongFormVideoSession: NO WhitelistedLongFormVideoApp NO15:08:23 mediaserverd   SSServerImp.cpp:1179:SystemSoundServerKillSoundsForPID: pid 477(ContactViewViewS)15:08:23 SpringBoard    <private> setEnabledTopics <private> ignoredTopics <private> opportunisticTopics <private> sendToDaemon: YES15:08:23 apsd   Looking up connection on peer: 1b848900   found <private>15:08:23 apsd   <private>: connection set enabled topics from <private> to <private>15:08:23 apsd   <private>: connection set opportunistic topics from <private> to <private>15:08:23 apsd   <private> setEnabledTopics:<private> ignoredTopics:<private> opportunisticTopics:<private> forCategory UsesALS pretend NO change Downgraded15:08:23 apsd   <private> cancelling any pending filter updates15:08:23 apsd   <private> received topic update for Server pretend YES but there is no change.15:08:23 apsd   <private> no change detected between the new and old server filter - cancelling any pending updates15:08:23 apsd   <private> flush any pending work that ALS told us to queue for its managed topics <private>, processMode systemToken15:08:23 apsd   <private> flush any pending work that ALS told us to queue for its managed topics <private>, processMode userToken15:08:23 apsd   <private> received topic update for Normal pretend NO but there is no change.15:08:23 SpringBoard    <private> setEnabledTopics <private> ignoredTopics <private> opportunisticTopics <private> sendToDaemon: NO15:08:23 locationd  {"msg":"#CLIUA Marking change", "clientKey":"com.vmaxtelecom.vmaxfone", "reason":"Decaying in-use status from process state", "assertionLevel":3, "coming":1}15:08:23 locationd  {"msg":"#CLIUA Marking change", "clientKey":"com.vmaxtelecom.vmaxfone", "reason":"Process state from RunningBoard", "assertionLevel":4, "coming":0}15:08:23 backboardd Lcurrent=258.9457 Lr=2.8489 DR=90.8935 factor=0.085215:08:23 CommCenter #I BundleID: <private> is no longer a foreground app15:08:23 backboardd Lcurrent=258.9457 Lr=2.8513 DR=90.8176 factor=0.085315:08:23 symptomsd  NBSM Current state: idle, changed: systemForeground to 0 for net type 015:08:23 symptomsd  NBSM Eligible to go to active15:08:23 symptomsd  NBSM Current state: idle, changed: systemForeground to 0 for net type 0, eligible for active but constraints unsatisfied (0,0,0)15:08:23 symptomsd  NBSM Current state: idle, changed: systemForeground to 0 for net type 0, ineligible for positive as nil pred, wifi (0x0) cell (0x0)15:08:23 symptomsd  NBSM Current state: idle, changed: systemForeground to 0 for net type 0, ineligible for broken as nil pred, wifi (0x0) cell (0x0)15:08:23 symptomsd  com.vmaxtelecom.vmaxfone: Foreground: false

If there's a concept, or something that will make my app dont being killed by the IOS itself, i will be grateful of your help.Thanks in advance.

App's icon and name on the Screen Time (iOS/React Native)

$
0
0

I'm having trouble correctly displaying my app's icon and name on the Screen Time screen in iPhone Settings (Here is an screenshot)

I already have all the images (AppIcon) in the Images.xcassets folder and the name of my app is already in Product Name in Build Settings (pointing the app project) and also in my info.plist but still not showing it correctly.

Everywhere it shows well except for Screen Time, please help 😔

Viewing all 16564 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>