Skip to content
This repository has been archived by the owner on Mar 3, 2024. It is now read-only.

Cannot read property 'secCompanyId' of null #42

Open
carlosriveroib opened this issue Oct 16, 2022 · 10 comments
Open

Cannot read property 'secCompanyId' of null #42

carlosriveroib opened this issue Oct 16, 2022 · 10 comments

Comments

@carlosriveroib
Copy link

I'm getting this error just doing this

import BleAdvertise from 'react-native-ble-advertise'

BleAdvertise.setCompanyId(0x00e0)

Captura de Pantalla 2022-10-16 a las 21 15 49

@finnholland
Copy link
Contributor

Should it not be import BLEAdvertiser from 'react-native-ble-advertiser'?
If this doesn't work I'll have a more in-depth look after your response :)

@Zero6d
Copy link

Zero6d commented Nov 2, 2022

import BLEAdvertiser from "react-native-ble-advertiser";
const APPLE_ID = 0x4c;
const MANUF_DATA = [1, 0];
// No scanner filters (finds all devices inc iPhone). Use UUID suffix to filter scans if using.
const SCAN_MANUF_DATA = Platform.OS === "android" ? null : MANUF_DATA;

BLEAdvertiser.setCompanyId(APPLE_ID);

@fhllnd its not work for me xcode keep throw error TypeError: Cannot read property 'setCompanyId' of null, js engine: hermes', reason: 'Unhandled JS Exception: TypeError: Cannot read property 'setCompanyId' of null, js engine: hermes

Screen Shot 2022-11-02 at 10 16 28

@vitorpamplona
Copy link
Owner

vitorpamplona commented Nov 2, 2022

Try to do

cd ios/
bundle exec pod install 

and then killing Metro and running your app again.

@Zero6d
Copy link

Zero6d commented Nov 3, 2022

hmm i did that and it seems like in podfile.lock there is no react-native-ble-advertiser
that is the only different between my project and example project

@Zero6d
Copy link

Zero6d commented Nov 3, 2022

it seems like only my project unable to detect this lib to import it into podfile.lock
other project work fine and i have no idea why

@vitorpamplona
Copy link
Owner

Yes, there is something going on in your config. Maybe some interference between native modules?

I just created a new project, installed this lib, run pod install, and added those lines and it seems to work just fine. I am not sure how to replicate the issue.

@finnholland
Copy link
Contributor

@Zero6d it seems to be working for me in my own project fine, just upgraded to 0.0.17 on ios and android with npm i @latest.

There apparently has been an issue that's appeared since 2022/11/4 which has caused run-android to fail, so I've created a PR to update the example to rn 0.70.5 mentioned here this should allow you to set up the example and debug between the working example and your own project.

You could try using the .tgz produced with npm pack in the root of the example project and see if that works. install it using npm i file:./react-native-ble-advertiser-0.0.17.tgz with relative path from package.json.

@Zero6d
Copy link

Zero6d commented Nov 16, 2022

i have to manually add pod 'react-native-ble-advertiser', :path => '../node_modules/react-native-ble-advertiser/ios' to podfile to fix cannot read property error
but i get new error when try to build apk on android and i already made new issue
can you check this out ? @fhllnd
#43

@AstanyTR
Copy link

AstanyTR commented Dec 22, 2022

same here after update to RN 0.69.7

@Vercjames
Copy link

Vercjames commented Dec 28, 2022

Adding

pod 'react-native-ble-advertiser', :path => '../node_modules/react-native-ble-advertiser/ios'

inside ios/PodFile under

target 'APPNAME' do 
  use_expo_modules!
  config = use_native_modules!
  ...
  pod 'react-native-ble-advertiser', :path => '../node_modules/react-native-ble-advertiser/ios'

Resolved the null error for me.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants