I am trying Kotlin Multiplatform on a Mac to develop an iOS app.  I cannot access UIDevice, I get “u...
z

ZabGo

over 5 years ago
I am trying Kotlin Multiplatform on a Mac to develop an iOS app.  I cannot access UIDevice, I get “unresolved reference: UIDevice”.  Does someone have any idea where the issue could come from? I am maybe missing something in my gradle config. The android studio kotlin plugin has the version 1.3.72. Thanks in advance for your help! Here my gradle files Build.gradle (project)
buildscript {
  ext.kotlin_version = '1.3.72'
  repositories {
    google()
    jcenter()
     
  }
  dependencies {
    classpath 'com.android.tools.build:gradle:3.6.3'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.72"



    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
  }
}

allprojects {
  repositories {
    google()
    jcenter()
     
  }
}
build.gradle(module)
plugins {
  kotlin("multiplatform")
}

Kotlin{
iosX64("ios"){
  binaries {
    framework {
      baseName = "SharedCode"
    }
  }
}

jvm("android")


  sourceSets["commonMain"].dependencies {
    implementation("org.jetbrains.kotlin:kotlin-stdlib-common")
    implementation("io.ktor:ktor-client-core:1.3.2")
    implementation("io.ktor:ktor-client-json:1.3.2")
    implementation("io.ktor:ktor-client-serialization:1.3.2")
  }

  sourceSets["androidMain"].dependencies {
    implementation("org.jetbrains.kotlin:kotlin-stdlib")
    implementation("io.ktor:ktor-client-android:1.3.2")

  }

  sourceSets["iosMain"].dependencies{
    implementation("org.jetbrains.kotlin:kotlin-stdlib")
    implementation("io.ktor:ktor-client-ios:1.3.2")
    implementation("io.ktor:ktor-client-json-native:1.3.2")
    implementation("io.ktor:ktor-client-serialization-native:1.3.2")

  }
}