SDK configuration issues
Fix SDK initialization failures, wrong API keys, test/production environment mismatches, and links that come back nil or null.
Fix an SDK that isn't talking to the Grovs backend as expected. Work top to bottom: an initialization failure causes everything below it.
SDK not initializing
Cause: a wrong or missing API key, or no network on the device. On iOS, the Grovs.configure completion receives success == false.
Fix: copy the API key from Developers → API Key in the dashboard. Pass it as shown in your platform's quick start: iOS, Android, Flutter, React Native, Web. On iOS, check the completion:
Grovs.configure(APIKey: "your-api-key", useTestEnvironment: false, delegate: self) { success in
if !success {
print("Grovs failed to initialize — check the API key and network")
}
}Also check:
- Where you configure. Use
application(_:didFinishLaunchingWithOptions:)on iOS andApplication.onCreate()on Android, not later. On Flutter the key lives inAndroidManifest.xml(grovs_api_key) andInfo.plist(GrovsApiKey). A typo in those key names leaves the SDK with no configuration, silently. - The SDK isn't disabled. After
setSDK(enabled: false), for example in a consent flow, nothing works until you re-enable it. On iOS, configuring withenabled: falsemakes the completion reportfalsewithout authenticating. That means "not started", not a bad key. See Privacy & Consent. - Self-hosted backends. Pass
baseURLwith the domain only. The SDK appends the API path.
Test vs production environment mismatch
Cause: each project has two environments, each with its own domain and URL scheme. The SDK targets one at configure time through useTestEnvironment (true = test, false = production). Links fail if a test build opens production links, or the app registers only one environment's domain and scheme.
Fix:
-
Set
useTestEnvironmentper build:truefor development,falsefor release.Platform Where iOS, Android, React Native configureparameterFlutter grovs_use_test_environmentmeta-data (Android),GrovsUseTestEnvironmentkey (iOS)Expo config plugin useTestEnvironmentproperty -
Register both environments in your app: both
applinks:domains (iOS), both URL schemes (iOS, Android), and both hosts in your Android intent filters (quick start). -
Test with links from the environment the build targets.
The REST API has the same split: the ENVIRONMENT header takes production or test. See Authentication.
Links not generating (nil/null in the callback)
Cause: the SDK couldn't create the link. generateLink returned nil/null (iOS, React Native), threw a GrovsException (Flutter, Android coroutine form), or passed an error to Android's (link, error) listener. Usually initialization failed earlier, the device is offline, or the request was rejected.
Fix:
- Confirm the SDK initialized (see SDK not initializing). A failed
configureis the most common cause. - On Android, log the listener's
error, or catchGrovsExceptionin the coroutine variant:
Grovs.generateLink(
title = "Check out this product",
data = mapOf("productId" to "12345"),
lifecycleOwner = this,
listener = { link, error ->
link?.let { Log.d("Grovs", "Generated: $it") }
error?.let { Log.e("Grovs", "Error: $it") }
}
)- Turn on debug logging and retry. The SDK logs the failing request.
Enable debug logging
Raise the SDK's log level and read the device logs: the Xcode console on iOS, Logcat on Android.
// iOS — levels: .info, .warn, .error
Grovs.setDebug(level: .info)// Android — levels: INFO, ERROR
Grovs.setDebug(LogLevel.INFO)// Flutter
await grovs.setDebugLevel('info');On React Native, call the native Grovs.setDebug in your AppDelegate/MainApplication, as in the React Native Quick Start.
Use info while integrating and lower it before release. The initialization and link-generation lines usually name the problem: bad key, network failure or rejected request.