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

Xcode debug build vs release build

$
0
0

I am currently building a react native app using expo.

However, I needed to use cocoapods, which is why I am now using Xcode.

Since I have switched to Xcode, there has been a difference between my local debugging builds (that I run to a USB connected iPhone) vs the builds that get pushed to TestFlight.

After doing some digging I have found that it may be due to the debug vs release schemes in Xcode.

From what I've see it seems that the difference should really just be in performance, file sizes, and some other aspects, but not what the app actually does and displays like in my case.

To test, I made a change on my app's homepage to simply have the text, UPDATED.

As expected, when ran with the debug scheme, the UPDATED text shows up, but when ran with the release scheme, it does not.

How do I get these to sync up and have the release build recognize the changes I make as I am certain I do not want to push a debug build to the app store?

Things I have tried:

  • Removing/cleaning Build folder and rebuilding
  • Updating Xcode
  • Running on another device
  • Building/running with expo (this did something, but it just causes the app to crash, assuming it is because of the cocoapods)

Versions:

  • react-native: 0.61.5
  • Xcode: 11.4.1
  • macOS: 10.15.3

Thank you


React Native IOS Subscription integration errors

$
0
0

i am using react-native(0.61.5)I created my auto-renewable packages via appstoreconnect. I want to subscribe to these packages that I have created using the react-native-iap package. but i am getting the errors in the image below.

note: OR i am getting empty products obj

enter image description here

my codes

export const IAP_SKUS = Platform.select({  ios: ['1' // my product id on applestoreconnect subscriptions  ],});getProducts = async () => { try {  const products: RNIap.Product[] = await RNIap.getProducts(IAP_SKUS);  console.log(products); } catch (err) {  console.log(err); }}

Where do I make mistakes, I can not perform the subscription even though I use the package as it is. Can you help me with this? or does it have a good documentation?

react-native run-ios fails with ld: symbol(s) not found for architecture x86_64

$
0
0

I am trying to build my react-native project on iOS simulator and getting the below error:

error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening MyProject.xcworkspace...ld: symbol(s) not found for architecture x86_64clang: error: linker command failed with exit code 1 (use -v to see invocation)** BUILD FAILED **

I have researched my part and tried possible solutions here and here which seem to not work.

I am using react-native version ~0.61.4 and Xcode Version 11.4.1 on macOS Catalina version 10.15.2Even the app doesn't start on simulator.

iOS: BrightCove native player throwing `kBCOVPlaybackSessionLifecycleEventError` playing same video on 2nd time

$
0
0

I want to resume video second time from the same time interval from which I left last time. But when I'm opening player for the second time, it either take longer time than the usual or (and mostly) it throws kBCOVPlaybackSessionLifecycleEventError Not sure what and why it's happening. Following is my pseude code to resume the video.Can anyone please help on this? In the native docs also, there is not much info is mentioned which can be of help. So do let me know if anyone has input on this one?

Summarising in one line: How can we seek in the start itself when BCOV player loads?

Here is the link for brightcove-ios-native SDK

func seekToTimeWithSeconds(seconds:Double) {    let seekToTime = CMTimeMakeWithSeconds(seconds, preferredTimescale: 60000)    playbackController?.seek(to: seekToTime, completionHandler: { [weak self] (finished: Bool) in        self?.playbackController.play()    })}

React Native ViroVRSceneNavigator.onExitViro method not called on Android Devices

$
0
0

I can't seem to get OnExitViro working on Android devices, but for iPhone the onExitViro method gets called and on iPhones it's showing a left arrow and on Android devices it is showing "X".

My dependencies are as follows:

"expo": "^36.0.2","expo-cli": "^3.16.1","expo-file-system": "^8.1.0","react": "16.8.3","react-native": "0.59.9","react-native-paper": "^3.6.0","react-native-responsive-fontsize": "^0.4.3","react-native-responsive-screen": "^1.4.1","react-native-unimodules": "^0.7.0","react-native-vector-icons": "^6.6.0","react-viro": "2.17.0","rn-bottom-drawer": "^1.4.3"

And here is the code I have for the onExitViro

  _exitViro (){    this.setState({      navigatorType: "UNSET"    })  }

and I am calling it on the ViroVRSceneNavigator as

onExitViro={this._exitViro.bind(this)}

Is there anything that I am doing wrong?

JSON value '' of type NSNull cannot be converted to NSString

$
0
0

I am getting the following error screen sometimes when I reload my React Native app in iOS Simulator.

enter image description here

Sometimes it doesn't happen at all but sometimes a few times during the day.

I am using SignalR client in my app as well as Firebase Messaging.

I have tried to put a try catch blocks to all of my app including where I use AsyncStorage but this is still happening.

Very frustrating.

Native base header adding extra height in iPhone x

$
0
0

I'm using the native base for the screen layout in react native. The Header component in the native base is adding an extra height apart from the actual height that I have specified.

My current native base version is 2.13.12.I'm facing the issue in the iPhone only and for the iPhone x and above models.Someone please helps me with fixing the issue.Screenshot of the issue

rn-apple-healthkit doesn't update immediately after coming back from background

$
0
0

i use rn-apple-healthkit to provide health service in my app, i setup observer and it work fine and updated after change on step, but when i back from background and tap reload button which it execute a function to get last step data it doesn't work immediately. thanks.

here is my file which i try to get latest update

  AppleHealthKit.initStepCountObserver({}, () => {});const getCurrentStep = useCallback(    () => {      let stepCount = {        date: moment().toISOString()      };      AppleHealthKit.getStepCount(stepCount, (err, results) => {        if (err) {          console.log(err);          setAnimatedStep(0);          return;        }        setAnimatedStep(results.value);      });    },    [animatedStep]  );

Why am I getting an iOS build error in EXPO?

$
0
0

I try to build applications using expo build: ios, I enter the apple id data, but in response I get an error:Authentication with Apple Developer Portal failed!502 Bad Gateway

snapshot

expo diagnosticsroot@66970:/home/dev/app/learnfast# expo diagnosticsExpo CLI 3.18.2 environment info:System:OS: Linux 4.9 Debian GNU/Linux 9 (stretch) 9 (stretch)Shell: 4.4.12 - /bin/bashBinaries:Node: 13.13.0 - /usr/local/bin/nodeYarn: 1.21.1 - /usr/local/bin/yarnnpm: 6.14.4 - /usr/local/bin/npmnpmPackages:expo: ~37.0.3 => 37.0.7react: ~16.9.0 => 16.9.0react-native: https://github.com/expo/react-native/archive/sdk-37.0.1.tar.gz => 0.61.4npmGlobalPackages:expo-cli: 3.18.2

How to share App link using react native Share API?

$
0
0

I am trying to share my app installation link to others from my app settings in react native.

I used the react native share api for this.

But using the below code the output only shows the message(code and screenshot below).

const shareAppOptions = {  title: 'App link',  message: 'Please install this app and stay safe',   url: 'https://play.google.com/store/apps/details?id=nic.goi.aarogyasetu&hl=en'};

enter image description here

What is the problem ?, I searched everywhere and no one has a proper example.

Is using expos intern filesystem API a better solution than the react-native-fs when the app will be published on Playstore / Appstore?

$
0
0

I am fairly new to AppDevelopment with react-native and I am using expo. I have a hard time writing to the file-system, especially with react-native-fs. So I heard about the expo-file-systemand that it might be easier to use instead.

However, I am not sure if the API will be available when I transfer the App to the Playstore / AppStore - what are the downsides of each one? And what would be a better solution in my case?

My use case is just writing User-Data into a json file, so nothing fancy

flatlist pull to refresh react native

$
0
0

I used below example and implemented the flatlist and lazy loading. But when I pull to refresh I need to add spinner, but the problem is my my control is not going inside handleRefesh . I event put console, but console is not printing. Can you tell me how to fix it. Providing my code snippet below.

https://scotch.io/tutorials/implementing-an-infinite-scroll-list-in-react-native

import * as React from 'react';import { ActivityIndicator, FlatList, Animated, Dimensions, LayoutAnimation, ScrollView, StyleSheet, Text, TouchableOpacity, View } from "react-native";//import ComingSoon from '../core/components/common/ComingSoon';//import { COLORS } from '../core/constants/Colors';//import { ScreenContainer } from '../core/layout/ScreenContainer';import { Table, TableWrapper, Row } from 'react-native-table-component';import CheckBox from 'react-native-check-box';import axios from 'axios';import {    LazyloadScrollView,    LazyloadView,    LazyloadImage} from 'react-native-lazyload';import data from './MOCK_DATA.json';export default function OrderDetails() {    // screen height and width    const { width, height } = Dimensions.get('window');    const [tableHead, setTableHead] = React.useState(['Head', 'Head2', 'Head3', 'Head4', 'Head5', 'Head6', 'Head7', 'Head8', 'Head9']);    const [widthArr, setWidthArr] = React.useState(['40, 60, 80, 100, 120, 140, 160, 180, 200']);    const [flatListData, setFlatListData] = React.useState([]);    const [totalFlatListData, setTotalFlatListData] = React.useState([]);    const [page, setpage] = React.useState(1);    const [loading, setloading] = React.useState(true);    const [loadingMore, setLoadingMore] = React.useState(false);    const [filtering, setFiltering] = React.useState(false);    const [refreshing, setRefreshing] = React.useState(false);    const [error, setError] = React.useState(null);    const [isChecked, setIsChecked] = React.useState(false);    console.log("Table ---->", Table);    let start = ~~(Math.random() * 900);    let list = data.splice(start, 100);    React.useEffect(() => {        loadLazyLoadingAPI();    }, []);    const loadLazyLoadingAPI = () => {        let headers: any = {};        if (page <= 5) {            headers['Content-Type'] = 'application/json';            axios.get(`https://api.punkapi.com/v2/beers?page=${page}&per_page=10`,                {                    headers: headers                }            )                .then(response => {                    console.log("lazyload", response);                    let data: any[] = flatListData;                    setFlatListData([...data, ...response.data]);                    setTotalFlatListData([...totalFlatListData, ...response.data]);                    setloading(false);                    setLoadingMore(false);                    setRefreshing(false);                })                .catch(error => {                    console.log(error);                    setloading(false);                })        }        // }    }    const handleRefesh = () => {        console.log('handle Refresh -->')        setpage(1);        setRefreshing(true);    }    const hadndleLoadingMore = () => {        console.log('handle loading more -->')        setpage(page + 1);        setLoadingMore(true);    }    const renderFooter = () => {        if (loadingMore) return null;        return (<View                style={{                    position: 'relative',                    width: width,                    height: height,                    paddingVertical: 20,                    borderTopWidth: 1,                    marginTop: 10,                    marginBottom: 10,                    //borderColor: colors.veryLightPink                }}><ActivityIndicator animating size="large" /></View>        );    };    React.useEffect(() => {        if (loading || loadingMore) {            loadLazyLoadingAPI();        }    }, [loading, loadingMore, page]);    if (loading) {        console.log('handle ActivityIndicator -->')        return (<View><Text style={{ alignSelf: 'center' }}>Loading beers</Text><ActivityIndicator /></View>)    }    return (<View style={styles.container}>            {/* <ScrollView      refreshControl={ <RefreshControl       refreshing={this.state.isFetching}       onRefresh={this.handleRefresh}       />       } > */}<CheckBox                style={{ flex: 1, padding: 10 }}                onClick={(e: any) => {                    if (!isChecked) {                        setFlatListData(totalFlatListData.filter((item: any) => {                            return item.id % 2 === 0;                        }));                    } else {                        setFlatListData(totalFlatListData);                    }                    setIsChecked(!isChecked);                }}                isChecked={isChecked}                leftText={"odd"}            /><CheckBox                style={{ flex: 1, padding: 10 }}                onClick={(e: any) => {                    if (!isChecked) {                        setFlatListData(totalFlatListData.filter((item: any) => {                            return item.id % 2 != 0;                        }));                    } else {                        setFlatListData(totalFlatListData);                    }                    setIsChecked(!isChecked);                }}                isChecked={isChecked}                leftText={"even"}            />            {/* <LazyloadScrollView       style={styles.container}       contentContainerStyle={styles.content}        //name="scrollExample"></LazyloadScrollView> */}<FlatList                contentContainerStyle={{                    flex: 1,                    flexDirection: 'column',                    height: '100%',                    width: '100%'                }}                data={flatListData}                keyExtractor={(item: any) => item.id.toString()}                renderItem={({ item }) => (<View                        style={{                            marginTop: 25,                            width: '50%'                        }}><Text>{item.name}</Text></View>                )}                onRefresh={handleRefesh}                refreshing={refreshing}                onEndReached={hadndleLoadingMore}                ListFooterComponent={renderFooter}                onEndReachedThreshold={0.5}                initialNumToRender={10}            />            {/* </ScrollView> */}</View>    );}const styles = StyleSheet.create({    container: {        flex: 1,        backgroundColor: '#F5FCFF'    },    content: {        paddingTop: 20,        justifyContent: 'center',        alignItems: 'center'    },    view: {        height: 70,        width: 320,        paddingVertical: 5,        borderBottomWidth: StyleSheet.hairlineWidth,        borderBottomColor: '#666'    },    file: {        width: 320,        flex: 1,        flexDirection: 'row'    },    id: {        width: 50,        alignItems: 'center',        justifyContent: 'center'    },    idText: {        fontSize: 10    },    detail: {        justifyContent: 'space-around',        flex: 1    },    name: {        textAlign: 'center',        lineHeight: 15,        color: '#666',        marginBottom: 5    },    email: {        fontSize: 10,        color: 'blue',        textDecorationColor: 'blue',        textDecorationLine: 'underline',        textDecorationStyle: 'solid'    },    ip: {        fontSize: 12,        color: 'grey'    },    gender: {        width: 50,        alignItems: 'center',        justifyContent: 'center'    },    genderText: {        fontSize: 10    },    title: {        color: '#333',        fontSize: 12    },    male: {        color: 'skyblue'    },    female: {        color: 'pink'    }});

Build Failing for React Native iOS, "Multiple commands produce" Error

$
0
0

We were working on a react native project. One of my team members added some native modules on Linux and linked android. By then I am trying to link things in iOS but the build is always failing with this kind of error trace. The Android project is building normally.

I deleted xyz.xcworkspace and Podfile.lock then tried pod install.
Also, I tried to delete my node_modules and then yarn install followed by yarn link.

react-native-cli: 2.0.1  react-native: 0.61.4  yarn 1.19.1Pod 1.8.4XCode Version 11.2.1 (11B500)macOS Catalina 10.15.1 (19B88)

xyz warning

duplicate output file '/Users/user/Library/Developer/Xcode/DerivedData/xyz-hhesslamjsqmbobykhskliclusph/Build/Products/Debug-iphonesimulator/xyz.app/AntDesign.ttf' on task: PhaseScriptExecution [CP] Copy Pods Resources /Users/faisal/Library/Developer/Xcode/DerivedData/xyz-hhesslamjsqmbobykhskliclusph/Build/Intermediates.noindex/xyz.build/Debug-iphonesimulator/xyz.build/Script-47F818C57EEC47EA3303EA1B.sh

xyz workspace errors

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

There are multiple errors and warnings like this but have same format with different file names.

connect VPN programmatically React Native Android / IOS

$
0
0

i am new to react native, i want to make a VPN app for android and IOS. VPN protocol IPSec or IKEv2 or any other. i have tried OpenVPN node-openvpn and openvpn-bin but no luck and i want to use other VPN protocols. can anyone help me out in this? Thanks

React Native "RNCSafeAreaView" was not found in the UIManager

$
0
0

enter image description here

I am running a react-native application on Mac. but I am getting "RNCSafeAreaView" was not found in the UIManager.


Missing realm constructoron iOS

$
0
0

I can run my app perfectly on Android, but in Ios I'm getting this error"Missing realm constructor, did you run react-native link realm?".I already try to run troubleshooting from realm website, but doesn't work.

How to add "Set as Wallpaper" option in React Native app

$
0
0

How to enable option "set as wallpaper" ? I'm using expo and I'm not able to find any API to enable that functionality.I only able to download image. I want to trigger set as wallpaper option.I tried to use react-native-wallpaper-manager library but it has not worked for me.

No known class method for selector 'labelColor' - react-native-image-crop-picker - for react-native iOS

$
0
0

I am using react-native-image-crop-picker library within react-native applicationVersion details

react-native version: 59.10 react-native-image-crop-picker: 0.25.3 xcode: 10.1

While execution of code I am getting the error QBImagePicker/QBAssetsViewController.m:198:31: No known class method for selector 'labelColor'

195    // Info label196    UIColor *labelColor = [UIColor blackColor];197    if (@available(iOS 13.0, *)) {198        labelColor = [UIColor labelColor];199    }

I have tried to upgrade library version but issue is still there. can anyone please help

Thank you in advance

React native expo - Reponse timed out

$
0
0

I'm trying to run an app inside my Android emulator and on my Iphone using Expo and Create React Native App.

I' ve ran the following commands to do this.

create-react-native-app MyFirstAppnpm run android

After doing the run command the app runs in the emulator with the following error:

Something went wrong! Could not load *ip*. Network response timed out.Uncaught error: java.net.SocketTimeoutException: connect timed out.

The same thing happens when I scan the QR code on my Iphone and I can't reach the ip in my web browser.

I've found the following fixes on internet but nothing seems to work:

  • Add port 19000 to the inbound rules in Windows Firewall
  • Update Java and npm
  • npm start instead of npm run android

Edit:

I installed Expo XDE to start the server. It works fine when I use a tunnel but that option is extremely slow when reloading changes. It still doesn't work with localhost or LAN. Is it possible that I have to use something like port forwarding to open this port on my router?

Also: When I typ: localhost:19000 in Google Chrome I get some Json returned. But this doesn't work when I'm in Expo!

JSON Parse error: Unexpected identifier "success" using ReactNative

$
0
0

I am new to react native trying to save data to mogo db database I am getting the warning but my data is inserted in database.

My Code is as follows:

fetch("http://8ae1999e.ngrok.io/send-data", {            method: "post",            headers: {'Content-Type': 'application/json',            },            body: JSON.stringify({                name,                email,                phone,                picture,                salary,                position            })        }).then(res => res.json())            .then(data => {                console.log(data)                Alert.alert(`${data.name} is saved.`)                navigation.navigate("Home");            })

But it gives me warning

' JSON Parse error: Unexpected identifier "success" using ReactNative'

while posing data and can't navigate to Home Screen as well.

Viewing all 16904 articles
Browse latest View live


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