简体   繁体   中英

KMM - Unresolved reference: platform for IOS application

Hellow. I have a trouble with template KMM application. It got an error after I created new KMM application - in shared IOS app module it cannot find package platform . It's on kotlin. Adroid app works well.

Need to say, that I works on window by Android studio. I know there are troubles to start IOS app on window, but I do not want to start or build app - I want to just it find the reference platform .

I tried to find some dicisions. There are the same questions, but nobody can answer them.

Code with trouble:

import platform.UIKit.UIDevice // here there is the error

actual class Platform actual constructor() {
    actual val platform: String = UIDevice.currentDevice.systemName() + " " + UIDevice.currentDevice.systemVersion
}

This question is a bit strange: how do you think iOS application will compile and work on a Windows computer?

To make KMM work on both OS you need a Mac. This is the reason why you are not able to find "platform.UIKit.UIDevice" on your machine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM