Hi Everyone, Can anyone please help me this error ...
# multiplatform
s
Hi Everyone, Can anyone please help me this error
Thread 1: EXC_BAD_ACCESS (code=1, address=0x0) when running KMM app in XCode
*import* UIKit
*import* kmm
@UIApplicationMain
*class* AppDelegate: UIResponder, UIApplicationDelegate {
*var* window: UIWindow?
*func* application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: *Any*]!) -> Bool {
window = UIWindow(frame: UIScreen.main.bounds)
*let* mainViewController = Main_iosKt.MainViewController()
window?.rootViewController = mainViewController window?.makeKeyAndVisible()
return
true
}
}
som error in AppDelegate class
d
That's odd. What does the
kmm
import give you? Are you trying to use Compose? I've never seen this before:
Main_iosKt.MainViewController()
s
yes i am trying to use compose view in ios
its supported now
d
Ah, then I can't help.
l
When you see the address is 0x0, that means it's a null pointer the Kotlin compiler didn't check for. This usually happens with weird constructor ordering, variable initializers that depend on each other through some odd method ordering (think
Copy code
val x = y; val y get() = x
, or some other initialization weirdness.
s
@Landry Norris Thanks