Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hard crash without any error #2

Open
mrousavy opened this issue May 30, 2020 · 2 comments
Open

Hard crash without any error #2

mrousavy opened this issue May 30, 2020 · 2 comments

Comments

@mrousavy
Copy link

Hi @adrianso ! I don't know where else to post this, but thanks for your changes to react-native-nearby-api! Couldn't find your fork of it, but I've finally got it working on my app.

I do have a problem though. I'm getting a hard crash on Simulators and real devices without any error information.

When only using NearbyApi.connect() everything works fine, but once I try to subscribe() or publish() the app crashes. (not instantly, but with a short delay).

image

My code:

const nearbyAPI = new NearbyAPI(true);
nearbyAPI.onFound((m) => {
	if (typeof m === 'string') onNearbyUserFound(m);
});
nearbyAPI.onPublishFailed((message) => {
	Logger.logError(`[NEARBY] Publishing User ID failed! ${message}`, new Error(`[GOOGLE-NEARBY] Publish failed! ${message}`));
});
nearbyAPI.onSubscribeFailed((message) => {
	Logger.logError(`[NEARBY] Subscribing to messages failed! ${message}`, new Error(`[GOOGLE-NEARBY] Subscribing failed! ${message}`));
});
nearbyAPI.onConnectionFailure((message) => {
	Logger.logError(`[NEARBY] Failed to connect BTE to Google Nearby! ${message}`, new Error(`[GOOGLE-NEARBY] Connection failure! ${message}`));
});
Logger.debug('[NEARBY] Connecting...');
nearbyAPI.connect(GOOGLE_NEARBY_API_KEY); // works fine
nearbyAPI.subscribe(); // executes
Logger.debug('[NEARBY] Connected!'); // executes

// about a second later the app crashes..

I'm guessing it has something to do with Bluetooth permissions, do you know how I can get this working?

Also, the library always includes Assets.car in [CP] Copy Pods Resources in Xcode Build Phases, do you know why this happens? Must be something in the podspec.. (See: badfeatures/react-native-nearby-api#33)

Thanks!

@mrousavy
Copy link
Author

Also I'm getting the following warning/error in the console when building my project:

2020-05-30 13:36:40.946 xcodebuild[57328:331500] +dataWithFirstBytes:1024 ofFile:"/Users/mrousavy/Projects/commercio/commercio-app/node_modules/@adrianso/react-native-nearby-api/LICENSE" failed, errno = 2

It still works fine and builds correctly, not sure if that's making any trouble though.

@mrousavy
Copy link
Author

Turns out I was right, it is because of the permissions. I had to manually request permissions using react-native-permissions.

The issue with the Assets.car still being included in Xcode resources remains unsolved though.

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

No branches or pull requests

1 participant