https://kotlinlang.org logo
Docs
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
multiplatform
  • r

    Ryan Simon

    02/13/2020, 6:42 AM
    hey all, I keep running into this error on iOS when trying to cast a type of
    Any
    to a more concrete type
    Could not cast value of type 'kobjcc0'
    a
    r
    b
    • 4
    • 17
  • r

    Ronald van D

    02/13/2020, 3:23 PM
    Hi, I’m trying to save data to the iOS keychain. I use the following piece of code to accomplish that:
    val searchDictionary = CFDictionaryCreateMutable(kCFAllocatorDefault, 5, null, null)
    
            CFDictionaryAddValue(searchDictionary, kSecClass, kSecClassGenericPassword)
            CFDictionaryAddValue(searchDictionary, kSecAttrService, CFBridgingRetain(appName))
            CFDictionaryAddValue(searchDictionary, kSecAttrGeneric, CFBridgingRetain(identifier))
            CFDictionaryAddValue(searchDictionary, kSecAttrAccount, CFBridgingRetain(identifier))
            CFDictionaryAddValue(searchDictionary, kSecValueData, CFBridgingRetain(NSNumber(int = 2048)))
    
     SecItemAdd(searchDictionary, null)
    But I keep getting OSStatus -50 (One or more parameters passed to a function were not valid.). I followed several Ojective-c tutorials to come up with this code and it should be valid.. Someone got an idea what I’m missing?
    k
    • 2
    • 6
  • k

    Kris Wong

    02/13/2020, 4:30 PM
    hmmm, I seem to be experiencing a deadlock inserting a record into a sql delight database (while running iOS tests)
    • 1
    • 2
  • k

    Kris Wong

    02/13/2020, 5:13 PM
    so the above issue is actually rooted in using
    CoroutineWorker.execute
    with
    CompletableDeferred
    . anyone have an idea why completing the deferred might deadlock when used from
    execute
    ?
    b
    • 2
    • 33
  • b

    basher

    02/13/2020, 7:36 PM
    in intellij, when you click a play button next to a test and choose debug, how do you change that to use a different target (i.e. android instead of mingw) for debugging?
    ⬆️ 1
    g
    • 2
    • 2
  • r

    Ryan Simon

    02/13/2020, 8:07 PM
    how should i be configuring my build script to use generics? i tried following the documentation and digging into the PR that added generics support but i don't know if i'm doing it right
    tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCommonCompile> {
        kotlinOptions {
            freeCompilerArgs = listOf("-Xobjc-generics")
        }
    }
    k
    • 2
    • 31
  • k

    Kris Wong

    02/13/2020, 8:46 PM
    has anyone figured out how to turn off the sql delight verbose logging?
    k
    y
    k
    • 4
    • 7
  • g

    gbaldeck

    02/14/2020, 5:19 PM
    Hi all, I have created this stack overflow with an issue I'm having in my
    build.gradle.kts
    file. I have marked the lines that have problems with comments. If you have any suggestions it would be a big help. https://stackoverflow.com/questions/60208710/spring-boot-gradle-dependencies-in-kotlin-multiplatform
    u
    • 2
    • 3
  • j

    Jaxon Du

    02/16/2020, 6:21 AM
    It appears that data class is not fully compatible with iOS SwiftUI/Combine ObservableObject. Using this template app: https://github.com/joreilly/PeopleInSpace which lists people in space. On iOS its using SwiftUI and MVVM with viewmodel class (inherit from ObservableObject) that has a list/array of People object which is Kotlin data class in commonMain. The iOS basically calls the Repository class in commonMain to retrieve a list of People objects and display in list view. ObservableObject in SwiftUI/Combine is setup to update the SwiftUI list view whenever there is any changes in viewmodel class. Everything works fine if youre not changing the content of People object, like the sample template app. But when you try to change the attribute of the People object, the update is not reflected in the SwiftUI list view. So I changed the viewmodel class to have a list of PeopleIOS object, which is a struct I define in iOS. When retrieving the list of People object from commonMain, I convert them to a list of PeopleIOS, and use this structure in SwiftUI list view. And the changes is reflected in SwiftUI list view. I’m only few days picking up KMP so not so sure if I did anything wrong. Trying to look for a sample app that has KMP/SwiftUI/Combine that edit the commonMain data class model, if there is any would like to take a look. And I find the KaMPKit too much for KMP beginner. It might do more damage than getting people to adopt KMP.
    👍 1
    💡 2
    a
    d
    +2
    • 5
    • 11
  • m

    Maurice Jouvet

    02/17/2020, 1:56 PM
    Ok I found the problem.. Missing the logback implementation. Weird that was working on iOS though without it..
    d
    • 2
    • 2
  • m

    Maurice Jouvet

    02/17/2020, 2:33 PM
    Ok now I have a weird issue. My application is working fine on debug mode. But not when build with release.. My issue came from the serializer here the message: • Can’t locate argument-less serializer for class • (Kotlin reflection is not available). For generic classes, such as lists, please provide serializer explicitly.
    n
    • 2
    • 1
  • t

    Tim Hauptmann

    02/18/2020, 9:58 AM
    Hey, when I link my Kotlin Multiplatform framework with an iOS app extension, I get this warning: „Linking against a dylib which is not safe for use in application extensions“ In Xcode I can set this build flag APPLICATION_EXTENSION_API_ONLY. I think I need to add this somehow to my framework target in the grade build script. Somebody knows how?
    t
    • 2
    • 2
  • s

    Slackbot

    02/18/2020, 10:31 AM
    This message was deleted.
    j
    • 2
    • 1
  • j

    Jurriaan Mous

    02/18/2020, 8:10 PM
    Is there any way to debug common tests with 1.3.6x? It currently does not stop at breakpoints. I develop a library mainly through common tests and that workflow is broken. It seems it was broken in the last Kotlin release and no activity to fix it in over a month. (I would expect a hotfix) Maybe I missed a method to make the tests pause at breakpoints? https://youtrack.jetbrains.com/issue/KT-35632
    k
    l
    s
    • 4
    • 5
  • c

    curioustechizen

    02/19/2020, 6:42 AM
    Are there any guidelines on when you should run tests for common code on all target platforms and when it is not needed? Context: In our mobile multiplatform app, our domain (use cases) are shared. This is just the business logic and there's no thread switch happening for example. The entire domain layer executes on a single thread. Currently we run these tests as JVM tests on the development host. Does it make sense to somehow test it on iOS as well, especially since this layer is not impacted by the memory model?
    j
    k
    r
    • 4
    • 7
  • e

    Etienne

    02/19/2020, 2:24 PM
    Is there a good list of MPP-ready open source libraries out there? Doing a bit of research for a talk I’m preparing. I’m aware of some of the big ones [okio, moshi, SQLDelight], but not much beyond that.
    r
    k
    +3
    • 6
    • 8
  • n

    Niro

    02/20/2020, 11:10 AM
    Hey, Can I get an answer please to whether the database created by sqlDelight is not suppose to persist changes made due to the fact that the database is created using the platform specific SQL drivers. If that’s true is there a way to persist the changes to be seen by more than one platform?
    k
    • 2
    • 7
  • g

    gmazzo

    02/20/2020, 8:47 PM
    Hey guys! I have an implementation doubt, may be you can help me: I have a shared single common class that internally holds a
    MutableMap
    , so: For JVM: I use the
    ConcurrentHashMap
    class For Web: I use just a
    mutableMapOf
    But for Native, I have to
    freeze()
    the singleton to avoid the
    IncorrectDereferenceException
    . So, if the whole graph is frozen, I don’t know how to have a
    MutableMap
    inside it. Any tips?
    a
    k
    r
    • 4
    • 14
  • m

    moltendorf

    02/21/2020, 6:48 AM
    Anyone know of jobs in this? I'm novice but been coding 20 years and this is the only way I've been able to solve my dreams. Just nobody is paying me to do it and minimal time to do it on my own...
    s
    • 2
    • 1
  • s

    sendoav

    02/21/2020, 7:57 AM
    Anyone has a working jacoco sample file?
    e
    c
    • 3
    • 19
  • s

    Sam

    02/21/2020, 3:15 PM
    I’m doing some multiplatform date work. Currently I have an expect class called
    Date
    . I have it aliased on the jvm as
    actual typealias Date = java.util.Date
    I would like to define a method in the expect class called
    before(date: Date): Boolean
    . Currently I’m doing it like:
    expect fun Date.before(date: Date): Boolean
    //jvm
    actual fun Date.before(date: Date): Boolean {
        return this.before(date)
    }
    This gives me a shadowing warning. Is there a way to do something like
    actual  fun Date.before(date: Date): Boolean = java.util.Date.before
    ?
    r
    r
    c
    • 4
    • 9
  • m

    mboudraa

    02/21/2020, 3:21 PM
    Good morning multiplatform trailblazers!!! I have a very noob question but i get mixed signals from the Internet. I can read here and there it’s possible to have access to generics from swift code by activating the
    Xobjc-generics
    flag on the compiler. That being said i keep having my type erased on the swift side and have to deal with a
    Any?
    instead. The type im trying to use is the
    Result
    type. Do you have any idea if it’s possible? Do I have to write my own
    Either
    type?
    r
    r
    • 3
    • 4
  • n

    napperley

    02/22/2020, 2:24 AM
    Getting stuck on trying to setup remote publishing to Bintray with a Kotlin Multiplatform project. Every time the publish Gradle task is run Gradle becomes stuck when the message
    Configure build..
    is outputted.
    l
    • 2
    • 17
  • n

    Neal Sanche

    02/22/2020, 11:25 PM
    I've been trying to get a KMP app to compile today to a WatchOS device. I swear this worked before, however the error I'm getting is:
    ld warning: ... building for watchOS-armv7k but attempting to link with file built for watchOS-arm64_32
    
    Undefined symbols for architecture armv7k:
      "_OBJC_CLASS_$_CommonAssignment", referenced from:
          objc-class-ref in ViewModel.o
    I don't remember seeing armv7k before. Any ideas about this?
    p
    • 2
    • 3
  • n

    Nikita Khlebushkin

    02/23/2020, 7:37 PM
    Hello! I have a KMP module called analytics-interface with targets
    ios
    and
    jvm
    that contains class A:
    class A {
        fun foo() { ... }
    }
    and another KMP module called analytics with targets
    ios
    and
    android
    that contains class B:
    actual class B : A() {
        fun bar() { ... }
    }
    When I run
    ./gradlew :analytics:assembleRelease
    , the analytics-release.aar artifact is generated, and when I plug it in Android library, I can do
    B().bar()
    but not
    B().foo()
    . What am I doing wrong? EDIT Added a project to reproduce the issue https://gitlab.com/NikitaKhlebushkin/kmp-multi-module
    k
    a
    +2
    • 5
    • 27
  • p

    Patrick

    02/25/2020, 10:33 AM
    Is there a way to figure out if I am using the debug or the release executable at runtime?
    d
    • 2
    • 1
  • p

    Patrick

    02/25/2020, 10:43 AM
    Is there a compile time option to hide the console window in Windows? Every time I start the App, the console is visible for a brief moment if I use
    FreeConsole()
    or
    ShowWindow(GetConsoleWindow(), SW_HIDE)
    m
    • 2
    • 2
  • n

    Nikita Khlebushkin

    02/25/2020, 12:46 PM
    TL;DR How to move/distribute built framework for iOS to another machine? Full story I have a framework in KMP with cocoapods dependency. I'm building it by ./gradlew :module:podspec, then add the location to Podfile and run pod install. Finally, I'm building iOS project that has the build phase from .podspec and it uses Framework and it's all good. Now, I need to plug the output framework into a project on another machine, so I go to build/bin/iosX64/debugFramework and send the myproject.framework to my friend on the another machine. He plugs it into Xcode, runs a build for simulator and gets
    Undefined symbols for architecture x86_64:
      "_OBJC_CLASS_$_AnalyticsInitParameters", referenced from:
          objc-class-ref in Analytic.o
      "_OBJC_CLASS_$_AnalyticsAnalytics", referenced from:
          objc-class-ref in Analytic.o
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    1. Is there a right way to distribute resulted iOS framework? 2. What am I doing wrong?
    k
    r
    • 3
    • 11
  • c

    curioustechizen

    02/25/2020, 3:05 PM
    Question about
    suspend
    functions and iOS: Am I correct in assuming that even when running on iOS, suspension does work as it does on Android (without blocking the thread it is running on etc)? The only limitation being that a
    suspend
    function cannot be invoked from Swift/Obj-C code?
    k
    r
    • 3
    • 3
  • s

    Slackbot

    02/25/2020, 3:30 PM
    This message was deleted.
    k
    • 2
    • 1
Powered by Linen
Title
s

Slackbot

02/25/2020, 3:30 PM
This message was deleted.
k

Kris Wong

02/25/2020, 3:39 PM
please don't cross post
View count: 2