PostHog.setup问题仅发生在带有xcode的android工作室中。它产生的误差是"0";apiKey不能为null或为空";。在ios中,它运行得很好,这对我来说似乎很奇怪,我不确定我做错了什么该函数的使用方式如下
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,
}
}
},
}
如果您的posthog.token
是实际配置中可能导致错误的空字符串
在文档中,您可以看到令牌应该是";API项目密钥";从PostHog项目的设置页面。https://app.posthog.com/project/settings如果你在PostHog云上