iOS App with Kotlin/Native: Getting Started |

In this tutorial, you’ll build an iOS app using Kotlin/Native. You’ll also take a look at the AppCode IDE from JetBrains!

This is a companion discussion topic for the original entry at

I tried to connect the mapView to the controller on the storyboard and got the following error. What should I try?

2018-11-09 17:05:58.338255+0100 MeteoriteFinder[59395:4681901] +[CATransaction synchronize] called within transaction
2018-11-09 17:05:58.561153+0100 MeteoriteFinder[59395:4681901] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x7ff1f64091e0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key mapView.'
*** First throw call stack:

It looks like the storyboard is still referencing the default UIViewController. You will need to update that in the identity inspector to use your MeteoriteMapViewController class. Those instructions are in the “Wiring up the Storyboard” section.

FYI - When I went to override mapViewDidFailLoadingMap, I used ‘ctrl + o’ to find the method. When I did this, it inserted a call to its super method, which will cause an error. You need to delete that call to super.

@drofwarcs Can you please help with this when you get a chance? Thank you - much appreciated! :]

Unfortunately the latest version of Appcode 2018.3.2 does not currently support the Kotlin/Native plugin

@anm8tr thanks for pointing that out. It looks like there is not a compatible plugin for AppCode 2018.3 yet. Fingers crossed that it’s in the works and will be released in a reasonable amount of time :slight_smile:

@ drofwarcs Hi! Could you please help with this?

After putting MeteoriteMapViewController into the Identity Inspecter class field and connecting the mapView to the storyboard by putting the stuff in the storyboard xml (yes, I copied in the mapView id to the destination property) it still builds. But when I run in a simulator, I get:

Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘-[MeteoriteMapViewController superview]: unrecognized selector sent to instance 0x7fbb49c04740’

The error is shown as “SIGABRT” in main.kt at the end of autoreleasepool

Cleaning the build folder does not help. I am using Xcode 10.1

@drofwarcs Can you please help with this when you get a chance? Thank you - much appreciated! :]

@fullmers, that looks like MeteoriteMapViewController was set in the Identity Inspector of the MKMapVIew instead of the UIViewController. To fix, go back to the Identity Inspector where you entered MeteoriteMapViewController and delete it. When you delete it, it should show that the default class is a MKMapView. Next, head back to the “Wiring up the Storyboard” section of the tutorial and follow those steps again. The part that says “Then, click on the ViewController icon above the simulated phone:”, is the key to making sure you have the right item selected for entering the MeteoriteMapViewController. If that field defaults to UIViewController when nothing has been entered, then you are at the right spot to enter MeteoriteMapViewController.

@drofwarcs Yes, it works. Thank you so much!

Hi, thanks for this great tutorial. I was following the instructions. However, I’m getting in red everything related to the iOS platform. I’m not sure why. Also I tried to start from scratch with a new Kotlin/Native project but I realized that it’s getting created with the new build.gradle.kts (Kotlin DSL) instead of a regular build.gradle. So I think that’s the reason. But I’m still unable to finish the example. Does anyone know how to change the JVM of the project or how to support interopc but in the build.gradle.kts? Many thanks in advance!

@drofwarcs Can you please help with this when you get a chance? Thank you - much appreciated! :]

Also I downloaded the Final project. Tried to build and run but I’m getting this:


/var/folders/46/fn8qn8t96czcx0y9qgt_v7mr0000gn/T/tmp10704034545005050946.m:1:10: fatal error: ‘AFURLSessionManager.h’ file not found

Execution failed for task ‘:cinteropAFNetworkingIos_x64’.

I’m using AppCode 2019.1.2 and JDK 11.0.2


Sorry for the late response. This tutorial was written with an older version of AppCode and the Kotlin Gradle plugin. Shortly after this tutorial came out, Kotlin Native had a major update that made this tutorial obsolete. If you are using a version of AppCode greater than 2018.2.3 and have a version of Kotlin greater than 1.3.0, the project in this tutorial will not build.

We have been watching the updates to Kotlin Native very closely and plan on updating this tutorial when development stabilizes a little.

This tutorial is more than six months old so questions are no longer supported at the moment for it. Thank you!