I see the following error in my Xcode project console. Even though I have updated the info.plist, but it breaks the app every time, and is not working - any help/suggestion please?
Error in the console:
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'The service configuration is
nil. You need to configureInfo.plistbefore using this method.
This is the screenshot of my info.plist where I have added all the necessary entries:

Also, I am configuring AWS in my code as well, see below:
import SwiftUI
import AWSCore
import AWSS3
import AWSCognito
import AWSCognitoIdentityProvider
// Singleton CognitoService class
class CognitoService: ObservableObject {
@Published var isLoggedIn: Bool = false // Declare isLoggedIn variable
var pool: AWSCognitoIdentityUserPool? // Declare pool variable
@Published var currentUser: String = "" // Add this line for user signin func
static let shared = CognitoService() // Singleton
private init() {
setupCognito()
}
private func setupCognito() {
let serviceConfiguration = AWSServiceConfiguration(region: .USEast1, credentialsProvider: nil)
// for now it's okay, but later use AWS Secrete Manager to store these credentials
let userPoolConfiguration = AWSCognitoIdentityUserPoolConfiguration(
clientId: "MY-APP-CLIENT-ID",
clientSecret: "MY-APP-CLIENT-SECRETE",
poolId: "MY-USER-POOL-ID"
)
AWSCognitoIdentityUserPool.register(with: serviceConfiguration, userPoolConfiguration: userPoolConfiguration, forKey: "UserPool")
self.pool = AWSCognitoIdentityUserPool(forKey: "UserPool") // Set pool variable
}
}
@main
struct lunastars_club_4: App {
@StateObject var cognitoService = CognitoService.shared
@StateObject var sharedViewModel = SharedViewModel()
init() {
setupAWS()
//_ = CognitoService.shared // Initialize CognitoService
}
func setupAWS() {
let credentialsProvider = AWSCognitoCredentialsProvider(regionType:.USEast1,
identityPoolId:"MY-IDENTITY-POOL-ID")
let configuration = AWSServiceConfiguration(region:.USEast1, credentialsProvider:credentialsProvider)
AWSServiceManager.default().defaultServiceConfiguration = configuration
}
var body: some Scene {
WindowGroup {
ZStack {
if cognitoService.isLoggedIn {
NebulaFunAppHomePage()
} else {
WelcomePage()
}
}
.environmentObject(cognitoService)
.environmentObject(sharedViewModel)
}
}
}
}
I tried adding cognito identity provider info in the info.plist, and updated my podfile. I am expecting that the app should not break after the info.plist is updated but it does break.