I initialized the API using the following methodology
https://www.docs.developers.amplitude.com/data/sdks/ios/#install
I connect API_KEY through Environment.
import UIKit
import Amplitude
class AppDelegate: NSObject, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: UIApplication.LaunchOptionsKey : Any]?) -> Bool {
// Enable sending automatic session events
Amplitude.instance().trackingSessionEvents = true
// Initialize SDK
Amplitude.instance().initializeApiKey("API_KEY")
// Set userId
Amplitude.instance().setUserId("userId")
// Log an event
Amplitude.instance().setServerZone(AMPServerZone.EU)
return true
}
}
import Amplitude
@main
struct easylearnApp: App {
let store: IAPStore
var locale = LocalizationManager()
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
@StateObject private var firebaseController = FirebaseController()
........
}
I get an error when I run the application:
ERROR: Connection response received:400, invalid_api_key
The key is correct.
What can I do about it?
Thank you in advance for your answers.
Max