Cannot find 'NotifierManager' in scope
KMPNotifier and Kotlin version: kmpnotifier version: 1.5.1, kotlin version: 2.1.10
Describe the bug After following the instructions, i get the error: iOSApp.swift:34:9 Cannot find 'NotifierManager' in scope
In which platform bug occurs? ios
To Reproduce Just hit the build
Expected behavior Based on the instructions, it should just work. I would prefer to have it set up as a normal dependency, that would be easier to maintain.
Additional info to help reproduce If possible logs, or even a small sample project to help reproduce your case.
Hi @mirzemehdi.
I've the same problem. I did everything based on the instruction, and I've no ideas what's wrong. Here is my iosApp file:
` import UIKit import ComposeApp import GoogleSignIn import FirebaseCore import FirebaseMessaging
@main class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow?
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
LetsGoAppKt.doInitMapKit()
FirebaseApp.configure()
NotifierManager.shared.initialize(configuration: NotificationPlatformConfigurationIos(
showPushNotification: true,
askNotificationPermissionOnStart: true,
notificationSoundName: nil
)
)
window = UIWindow(frame: UIScreen.main.bounds)
if let window = window {
window.rootViewController = MainKt.MainViewController()
window.makeKeyAndVisible()
}
return true
}
func application(
_ app: UIApplication,
open url: URL,
options: [UIApplication.OpenURLOptionsKey: Any] = [:]
) -> Bool {
return GIDSignIn.sharedInstance.handle(url)
}
} `
and here are fragments from my build.gradle.kts file:
listOf( iosX64(), iosArm64(), iosSimulatorArm64() ).forEach { it.binaries.framework { export(libs.kmpNotifier) baseName = "ComposeApp" isStatic = true } }
commonMain.dependencies { ... other dependencies ... api(libs.kmpNotifier) }
I read other closed issues but they have no solutions for me. I also have no problems with java heap space. If I forgot any obvious things maybe it makes a sense to add it to the instruction? Maybe should I instal some packages from the xcode package manager?
If anyone is having this issue, I ended up resolving it but I'm not sure what steps fixed it exactly. I was trying to get the iOS app to build and run in Android Studio and happened to get this error fixed as well. The two steps I think that could have helped are:
-
downgrading Xcode to 16.0, since I was getting a warning that this was the latest version tested with Android Studio
-
Ensuring the Xcode project file was pointed at the xcworkspace instead of the xcodeproj file.
Got the same issue, not sure what's going on. As a workaround I have executed that code from the commonMain.
Any updates?
Got the same issue, not sure what's going on. As a workaround I have executed that code from the commonMain.
Its worked for me too. Other solution that worked for me: when I changed my dependencies from cocoapods to the SPM, the NotifierManager become accessible in iOSApp.
Technically, if in your gradle you export the library, it should be accesible from ios side. I am not sure what would be wrong. If you can provide minimum reproducible project githublink. I could loot at it
I am getting same error
Compile iOSApp.swift (arm64) (15, 9) Cannot find 'NotifierManager' in scope (15, 58) Cannot find 'NotificationPlatformConfigurationIos' in scope (18, 36) 'nil' requires a contextual type