Platform iOS
OS version iOS 9
Steps to reproduce
- npm react-native-beacons-manager
- react-native link react-native-beacons-manager
- pod install
Actual behavior iOS gives me the error:
In pod install: 'No podspeec found in this path" Xcode error: 'React/RCTBridge.h' file not found, In simulator getting this error: 'Null is not an object in Beacons.requestWhenInUseAuthorization();"
- "react": "16.9.0",
- "react-native": "0.61.5",
- "react-native-beacons-manager": "^1.0.7"
Someone can help me?
import React from 'react';
import {
Dimensions,
ImageBackground,
TouchableOpacity,
View,
StatusBar,
Platform,
Alert,
DeviceEventEmitter
} from 'react-native';
import Pulse from 'react-native-pulse';
import _map from 'lodash/map';
import Reactotron from 'reactotron-react-native';
import ScalableText from 'react-native-text';
import { connect } from 'react-redux';
import RNModal from 'react-native-modal';
import { NavigationEvents } from 'react-navigation';
import Icon from 'react-native-vector-icons/Ionicons';
import _filter from 'lodash/filter';
import _intersectionBy from 'lodash/intersectionBy';
import _forEach from 'lodash/forEach';
import Beacons from 'react-native-beacons-manager';
class PulseScreen extends React.Component {
startBeacon = () => {
if (Platform.OS === 'ios') {
Reactotron.log('iosPLatform');
const region = {
identifier: 'estimote',
uuid: '1a9f0cfb7d4bfc0e3071bffe2455261e'
};
Beacons.requestAlwaysAuthorization();
Beacons.startRangingBeaconsInRegion(region)
.then((data) => {
Alert.alert('', `Beacons monitoring started!`);
})
.catch((error) => {
Alert.alert('', `Beacons start error! IOS`);
});
DeviceEventEmitter.addListener('beaconsDidRange', (data) => {
Alert.alert('', 'beacons monitering started')
if (data.beacons.length) {
this.setState({ detectedBeacons: data.beacons });
Alert.alert(`Found beacons!`, JSON.stringify(data.beacons));
}
});
Beacons.startUpdatingLocation();
}
else {
Reactotron.log('else');
Beacons.detectIBeacons();
Beacons.detectAltBeacons();
Beacons.detectEstimotes();
Beacons.detectEddystoneUID();
Beacons.detectEddystoneTLM();
Beacons.detectEddystoneURL();
Beacons.startRangingBeaconsInRegion('REGION1')
.then((data) => {
Alert.alert('', `Beacons monitoring started!`);
})
.catch((error) => {
Alert.alert('', `Beacons start error!`);
});
DeviceEventEmitter.addListener('beaconsDidRange', (data) => {
if (data.beacons.length) {
this.setState({ detectedBeacons: data.beacons });
Alert.alert(`Found beacons!`, JSON.stringify(data.beacons));
}
});
}
};
render() {
const { nearbyStores } = this.state;
const { beaconList } = this.props;
return (
<View><NavigationEvents
onWillFocus={() => {
StatusBar.setBarStyle('light-content', true);
if (beaconList.length) {
this.startBeacon();
}
}}
onWillBlur={() => {
if (beaconList.length) {
Beacons.stopRangingBeaconsInRegion('REGION1')
.then(() => {
Alert.alert('', `Beacons monitoring stopped succesfully!`);
})
.catch((error) => {
Alert.alert(`Beacons stop error!`);
});
}
StatusBar.setBarStyle('dark-content', true);
}}
/>