react-native-beacons-manager icon indicating copy to clipboard operation
react-native-beacons-manager copied to clipboard

RN 0.63.5 - null is not an object - BeaconsManager.requestWhenInUseAuthrization

Open iSaBo96 opened this issue 3 years ago • 9 comments

Hello everybody, i get the following error when i use the libary

RN Version: 0.63.4 Plattform: iOS iOS: 14

I set up a new app and add the "react-native-beacon-manager" libary.

Steps to reproduce

  1. react-native init MyBeaconTest
  2. npm install --save react-native-beacon-manager
  3. Add following Code in my "App.js"
import React, {Component} from 'react';
import {
  View,
  Text,
} from 'react-native';
import Beacons        from 'react-native-beacons-manager';

export default class App extends Component {

  // Componente wurde geladen
  componentWillMount() {
    Beacons.requestWhenInUseAuthorization();
  }

  render() {
    return (
        <View><Text>123123123</Text></View>
    );
  }
};

Following Error will be triggered:

image

Should i link the Libary manually? I use React-Native 0.63.4. So i think an autolinking is active.

Thanks for your help :)

iSaBo96 avatar Jan 09 '21 10:01 iSaBo96

@MacKentoch Push, maybe you can help me. it would be my pleasure.

iSaBo96 avatar Jan 30 '21 13:01 iSaBo96

Were you able to fix this, I'm facing this error too

mahendraios avatar Mar 21 '22 13:03 mahendraios

I have linked the libary manually again and after this it works

iSaBo96 avatar Mar 22 '22 20:03 iSaBo96

I have linked the libary manually again and after this it works

How you can linked the library manually ? Help me please

duylinhdang1998 avatar Dec 20 '22 18:12 duylinhdang1998

Drag "node_modles/react-native-beacons-manager/ios/RNiBeacon.xcodeproj" to Libraries in your xcode structure

iSaBo96 avatar Dec 20 '22 19:12 iSaBo96

I get the error when linking manually. React/RCTBridge.h file not found! How can I fix that? Help me please

duylinhdang1998 avatar Dec 21 '22 02:12 duylinhdang1998

I write you at the evening. In germany we have 7 clock am

iSaBo96 avatar Dec 21 '22 05:12 iSaBo96

Thanks! Help me if you're freetime

duylinhdang1998 avatar Dec 21 '22 08:12 duylinhdang1998

You have to link the library manually and add the following paths:

  1. Link RNiBeacon.xcpdeproj (Drag from node_modules/react-native-beacons-manager/ios to libraries folder in your xcode) image
  2. Go to your project target and link your binaries. image
  3. Add this path "$(SRCROOT)/node_modules/react-native-beacons-manager/ios" to Headers Search Paths for your App image
  4. Add this paths $(SRCROOT)/../../../../ios/Pods/Headers/Public/React-Core, $(SRCROOT)/../../../../ios/Pods/Headers/Public/Yoga, $(SRCROOT)/../../../../ios/Pods/Headers/Public/YogaKit to Headers Search Paths for RNiBeacon: image

Info: This answer was from the post in https://stackoverflow.com/a/74747124/3625778

iSaBo96 avatar Dec 21 '22 18:12 iSaBo96

Info: if you run "npm" or "yarn" install you have to add the paths again or use "npx patch-package react-native-beacons-manager" for permanantly add

iSaBo96 avatar Dec 23 '22 17:12 iSaBo96