PostHog.setup issue only occurs in android studio with xcode. The error it produces is "apiKey must not be null or empty ". In ios it works perfectly which seems strange to me, i'm not sure what i'm doing wrong the function is used as follows
import Posthog from 'posthog-react-native';
import Gleap from 'react-native-gleapsdk'
export default function App() {
useAutoUpdateAppHandler({
versionUrl: config.versionUrl,
versionRelease: config.versionRelease,
appName: 'UPchieve',
});
Posthog.setup(posthogConfig.token, posthogConfig.settings)
Gleap.initialize(gleapConfig.token)
}
this is the config
const Config = {
demo: {
webSocketUrl: 'https:...',
socketUrl: 'wss://demo....',
baseUrl: 'https://demo....',
versionUrl: 'https://cdn....',
versionRelease: '2.0.0',
},
prod: {
baseUrl: 'https://...',
},
posthog: {
token: '',
settings: {
host: 'https://...',
captureApplicationLifecycleEvents: true,
captureDeepLinks: true,
iOS: {
capturePushNotifications: true,
}
}
},
}
If your
posthog.token
is the empty string in the actual config that could be causing the errorIn the documentation you can see that the token should be the "Project API key" from the settings page of your PostHog project. https://app.posthog.com/project/settings if you're on PostHog cloud