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
ios
  • g

    galex

    06/06/2019, 8:14 AM
    Hello, general question for the iOS people here. When Swift version updates, what does it mean for code written in Kotlin compiled by Kotlin/Native?
    l
    f
    5 replies · 3 participants
  • d

    darkmoon_uk

    06/06/2019, 8:13 PM
    Anyone have common gotcha's for AppCode not really parsing Kotlin code? I'm not seeing any errors highlighted despite Gradle being synced and the Kotlin plugin being installed.
    o
    d
    3 replies · 3 participants
  • a

    andrew

    06/10/2019, 10:44 PM
    what do you think?
    a
    f
    2 replies · 3 participants
  • d

    darkmoon_uk

    06/14/2019, 10:48 AM
    To establish the Event Loop required to use Ktor in iOS, should I put the whole content of the
    main
    function inside
    runBlocking
    ? I'm aware that only the main thread can be used for coroutines at present, and have created a main thread Dispatcher, but launching with this dispatcher - according to the error I'm receiving - does not set up an Event Loop.
    e
    1 reply · 2 participants
  • p

    pardom

    06/20/2019, 9:00 PM
    Hey, all. Does anyone know how to set the framework name for multiplatform projects which use the cocoapods plugin?
    f
    s
    +1
    4 replies · 4 participants
  • m

    Marc Reichelt

    07/01/2019, 11:28 AM
    We could really need some help 😊
    e
    12 replies · 2 participants
  • m

    Marc Reichelt

    07/01/2019, 12:46 PM
    Or does anyone have a good Android/iOS Kotlin Multiplatform example? Only requirement is that it has to build with Xcode 10.2.1… 🙂
    r
    k
    14 replies · 3 participants
  • m

    Marc Reichelt

    07/04/2019, 1:30 PM
    By the way: The example https://github.com/Kotlin/mpp-example works, but it uses Kotlin 1.3.31 native/multiplatform plugins. It seems the change to 1.3.40 is not trivial, and the build breaks if one tries to simply bump up the version. Did anyone try to get
    mpp-example
    up and running with Kotlin 1.3.40?
    l
    r
    10 replies · 3 participants
  • d

    darkmoon_uk

    07/05/2019, 5:18 AM
    Can anyone from JB comment on roadmap for Kotlin/Native/iOS in AppCode? The current Kotlin plugin is incompatible with 2019.2 and there's no mention of when it might be fixed... my company are considering making a considerable investment in going down the Kotlin/Multiplatform path for mobile; early experiments are working but we're finding the lack of clarity around IDE support worrying.
    👍 1
    o
    m
    +1
    3 replies · 4 participants
  • r

    Rainer Schlonvoigt

    08/02/2019, 10:59 AM
    what's the official way of setting the version number of a kotlin-native iOS framework? Currently it always reports 1.0
    a
    s
    7 replies · 3 participants
  • h

    Hauke Radtki

    09/09/2019, 10:18 AM
    Is it possible to aquire field references of kotlin classes from objective-c or swift? Like
    val prop = SomeClass::property
    ?
    s
    1 reply · 2 participants
  • r

    Rainer Schlonvoigt

    09/09/2019, 1:49 PM
    does not work because
    Cannot create binary debugFramework: binary with such a name already exists
    s
    4 replies · 2 participants
  • e

    einar

    09/26/2019, 5:36 PM
    Has anyone had success with custom build configurations in xcode (those apart from debug and release) together with a MPP shared library? I have created a configuration called PreProd that targets a different server url. When trying to build that configuration in iOS I get
    No enum constant org.jetbrains.kotlin.gradle.plugin.mpp.NativeBuildType.PREPROD
    . (Im using cocoapods)
    b
    8 replies · 2 participants
  • s

    Steve Young

    10/07/2019, 1:39 PM
    is this the right way to declare the hidden method? @kotlinx.cinterop.ObjCMethod(“”, “”) external fun NSURLRequest.Companion.setAllowsAnyHTTPSCertificate(allow: Boolean, host: NSString):kotlin.Unit
    s
    4 replies · 2 participants
  • t

    Tim Hauptmann

    10/17/2019, 12:12 PM
    Hey, when I run the following code on an iOS simulator useCompanion() will produce a runtime crash. The method useInner() works perfect. Furthermore, this only happens when I inherit from UIScrollView. Is this wrongly used? Or is this a bug I should report?
    import kotlinx.cinterop.CValue
    import kotlinx.cinterop.cValue
    import kotlinx.cinterop.useContents
    import platform.CoreGraphics.CGRect
    import platform.UIKit.NSDirectionalEdgeInsetsMake
    import platform.UIKit.UIScrollView
    class Test(frame: CValue<CGRect>) : UIScrollView(frame) {
    private val innerInsets = NSDirectionalEdgeInsetsMake(top = 15.0, leading = 8.0, bottom = 15.0, trailing = 8.0)
    companion object {
    private val companionInsets = NSDirectionalEdgeInsetsMake(top = 15.0, leading = 8.0, bottom = 15.0, trailing = 8.0)
    }
    fun useInner(): Double {
    return innerInsets.useContents { top } //This line works
    }
    fun useCompanion(): Double {
    return companionInsets.useContents { top } //This line produces runtime crash on iOS Simulator: Thread 1: EXC_BAD_ACCESS
    }
    }
    a
    4 replies · 2 participants
  • j

    JoakimForslund

    10/23/2019, 1:25 PM
    So basicly, I have recently had to add support for armv7 and i have data classes that gets translated from json. These data classes contains Long i order to handle big values. Now trying to run this framework in xode I get
    Undefined symbols for architecture armv7:
      "_OBJC_CLASS_$_KotlinLong", referenced from:
          objc-class-ref in TestViewController.o
    Is there anything to do about that?
    a
    2 replies · 2 participants
  • d

    Dmitri Sh

    10/24/2019, 1:10 AM
    reposting from the general channel, as no answers, maybe better luck here? Hi. A multiplatform project, android and iOS. In common code, I have an interface -
    interface Idea
    . When in Swift, want to have a struct implement this interface, a.k.a now as protocol in the Swiftland. Get a compiler error -
    inheritance from non-protocol type 'Idea'.
    In the generated objective-c file I see this -
    __attribute__((objc_subclassing_restricted))
    . Reading on it, all objective c protocols are restricted to classes. So how I do get around this problem - or no getting around and have to use classes in Swift😥?
    b
    a
    +1
    5 replies · 4 participants
  • k

    Konstantin Petrukhnov

    10/28/2019, 12:23 PM
    Is it possible to refer to resource file that is inside ".framework" bundle, from arm64/x64 source? E.g. mpp library project, that have sources and few resource files. In jvm files inside jar could be access through classpath, but is it possible to do similar on ios? Now I'm using Bundle.url(forResource) in swift, and then pass path string to kotlin, that will access file.
    s
    a
    22 replies · 3 participants
  • r

    Rainer Schlonvoigt

    11/08/2019, 12:57 PM
    is there a specific reason for that? will stuff break if we override this setting?
    a
    2 replies · 2 participants
  • t

    Tim Hauptmann

    11/14/2019, 9:36 AM
    Hey, I have a Kotlin multiplatform project which creates an Xcode-framework. I want to draw a class dependency graph of the framework. I found this tool for pure Objective-C sources https://github.com/nst/objc_dep And there are many tools out there which can process a .jar. Somebody knows a tool which can process an Xcode-framework or the Kotlin source files?
    m
    6 replies · 2 participants
  • d

    darkmoon_uk

    11/17/2019, 10:51 PM
    message has been deleted
    k
    1 reply · 2 participants
  • k

    Konstantin Petrukhnov

    11/19/2019, 4:42 PM
    Going back to my problem with text file inside bundle. Now I have dynamic library, and calling next code in Swift resolved to kotlin framework:
    let b1 = Bundle(for: KotlinInt.self).bundlePath
    But calling similar code in Kotlin code resolved to main app bundle (same with specific MyClass that inside framework):
    val bundle1 = NSBundle.bundleForClass(object_getClass(Int)!!).bundlePath
    Calling to get all bundles, successfully resolve all bundles as list:
    val bundle7 = NSBundle.allBundles().joinToString { (it as NSBundle).bundlePath }
    Is there some better way, than iterate through all bundles and try to find resource in each of it?
    (bundle as NSBundle).pathForResource(fileName, null)
    s
    m
    9 replies · 3 participants
  • r

    ribesg

    11/25/2019, 3:21 PM
    How to you read from a
    NSInputStream
    into a
    ByteArrayChannel
    without filling the RAM? Anyone got an example of that? I’ve got something which does not seem to work and even freezes the app with bigger files
    2 replies · 1 participant
  • a

    Andreas Jost

    11/26/2019, 10:20 AM
    Hi guys, I just realized there is a dedicated ios channel. Let me copy-paste my question from kotlin-native: Can anybody help me, how to add a GestureRecognizer to a UIView from Kotlin? I'm trying to achieve the ability to start a function (passed as a lambda), when a View is pressed. Here is what I tried: (ViewContainer is a typealias for UIView, I want to use this in the common presenter of an Android/iOS-Multiplatform project)
    actual fun ViewContainer.setOnCLickListener(block: () -> Unit) {
        val funRef = StableRef.create(InvokeClickListener(block))
    
        this.addGestureRecognizer(UITapGestureRecognizer(this, funRef.asCPointer()))
    }
    
    class InvokeClickListener(private val block: () -> Unit) : () -> Unit {
        override operator fun invoke() {
            block()
        }
    }
    I already managed to set the visibility of Views in the common code. If interested I can post code snippets in the multiplatform channel. But this case is harder, because UITapGestureRecognizer wants a selector/COpaquePointer and I can't find a solution. Error: 'NSInvalidArgumentException', reason: '(null): unrecognized selector sent to instance 0x7f9da94c0a00' Thanks in advance!
    a
    m
    7 replies · 3 participants
  • a

    Andreas Jost

    12/05/2019, 1:30 PM
    Hi, has anybody tried to use the Keychain Services API from Kotlin? I hoped it'd be possible to translate that to Kotlin: https://agostini.tech/2017/03/06/creating-a-simple-keychain-wrapper/ Here is an example of CFDictionary with Kotlin: https://github.com/JetBrains/kotlin-native/issues/3013 But I'm stuck, here are my thoughts:
    fun keychainQuery(key: String) = 
        CFDictionaryCreateMutable(null, 5, null, null).also {
            CFDictionaryAddValue(it, kSecClassGenericPassword, kSecClass)
            CFDictionaryAddValue(it, key.cstr, kSecAttrService)
            CFDictionaryAddValue(it, kSecAttrAccessibleWhenUnlockedThisDeviceOnly, kSecAttrAccessible)
        }
    
    fun load(key: String) : String {
        val query = keychainQuery(key)
        
        CFDictionaryAddValue(query, kCFBooleanTrue, kSecReturnData)
        CFDictionaryAddValue(query, kCFBooleanTrue, kSecReturnAttributes)
    
        memScoped {
            val result: CFTypeRefVar = alloc()
            val status = SecItemCopyMatching(query, result.ptr)
            
            val resultsDict = result as CFDictionaryRef // <-- This cast can never succeed
            val resultsData: COpaquePointer? = CFDictionaryGetValue(result, kSecValueData)
        }
    }
    e
    s
    +1
    10 replies · 4 participants
  • h

    Hauke Radtki

    12/06/2019, 2:25 PM
    Are default parameter values not supported in swift/ios interop?
    class Foo(val ref: () -> Long = ::defaultReference)
    does not allow Foo to be instantiated in iOS without specifying a value for
    ref
    b
    4 replies · 2 participants
  • r

    ribesg

    12/11/2019, 10:29 AM
    Anyone knows a good up to date tutorial on how to create a 100% Kotlin iOS app (not just a framework) ?
    a
    a
    +4
    22 replies · 7 participants
  • k

    kpgalligan

    12/11/2019, 10:22 PM
    Anybody see this doing a release build with 1.3.61?
    e: java.lang.IllegalStateException: no implementation for @kotlin.native.SymbolName public final external fun compareAndSet(expected: T, new: T): kotlin.Boolean defined in kotlin.native.concurrent.AtomicReference[DeserializedSimpleFunctionDescriptor@3a66e67e]
    s
    3 replies · 2 participants
  • c

    Cristián Arenas

    01/05/2020, 2:57 AM
    How do I create an
    NSRange
    in Kotlin? I can’t find
    init(location: Int, length: Int)
    , I can only find a constructor that requires a
    kotlinx.cinterop.NativePtr
    🤔
    1 reply · 1 participant
  • g

    gonzooin

    01/08/2020, 2:42 PM
    Hello, i’m trying to call addTarget on an UITextField but it crash at runtime. Kotlin code
    init {
            uiView.searchTextField.addTarget(this, platform.darwin.sel_registerName("searchTextChanged"), UIControlEventEditingChanged)
        }
    
        @ObjCAction
        private fun searchTextChanged() {
            // some code 
        }
    iOS Crash
    2020-01-08 15:34:46.891004+0100 Production[69085:8719071] -[kobjcc0 searchTextChanged]: unrecognized selector sent to instance 0x6000036b1620
    2020-01-08 15:34:46.897007+0100 Production[69085:8719071] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[kobjcc0 searchTextChanged]: unrecognized selector sent to instance 0x6000036b1620'
    *** First throw call stack:
    (
    	0   CoreFoundation                      0x00007fff23c7127e __exceptionPreprocess + 350
    	1   libobjc.A.dylib                     0x00007fff513fbb20 objc_exception_throw + 48
    	2   CoreFoundation                      0x00007fff23c91fd4 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
    	3   CoreFoundation                      0x00007fff23c75c4c ___forwarding___ + 1436
    	4   CoreFoundation                      0x00007fff23c77f78 _CF_forwarding_prep_0 + 120
    	5   UIKitCore                           0x00007fff48093fff -[UIApplication sendAction:to:from:forEvent:] + 83
    	6   UIKitCore                           0x00007fff47a6c00e -[UIControl sendAction:to:forEvent:] + 223
    	7   UIKitCore                           0x00007fff47a6c358 -[UIControl _sendActionsForEvents:withEvent:] + 398
    	8   UIKitCore                           0x00007fff4839655f -[UITextField fieldEditorDidChange:] + 202
    	9   UIKitCore                           0x00007fff4837b53a -[UIFieldEditor textInputDidChange:] + 61
    	10  UIKitCore                           0x00007fff483a6d45 -[UITextInputController _sendDelegateChangeNotificationsForText:selection:] + 104
    	11  UIKitCore                           0x00007fff483a9628 -[UITextInputController _insertText:fromKeyboard:] + 765
    	12  UIKitCore                           0x00007fff483aa07f -[UITextInputController insertText:] + 336
    	13  UIKitCore                           0x00007fff4837ec97 -[UIFieldEditor insertFilteredText:] + 838
    	14  UIKitCore                           0x00007fff4839c5e3 -[UITextField insertFilteredText:] + 93
    	15  UIKitCore                           0x00007fff47ea906b -[UIKeyboardImpl insertText:] + 147
    	16  UIKitCore                           0x00007fff47ea3863 -[UIKeyboardImpl _performKeyboardOutput:shouldCheckDelegate:] + 1059
    	17  UIKitCore                           0x00007fff47ea24bd __55-[UIKeyboardImpl handleKeyboardInput:executionContext:]_block_invoke_2 + 372
    	18  UIKitCore                           0x00007fff47ed1ab1 -[UIKeyboardTaskEntry execute:] + 147
    	19  UIKitCore                           0x00007fff47ed05c7 -[UIKeyboardTaskQueue continueExecutionOnMainThread] + 310
    	20  Foundation                          0x00007fff25781c30 __NSThreadPerformPerform + 259
    	21  CoreFoundation                      0x00007fff23bd4471 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    	22  CoreFoundation                      0x00007fff23bd439c __CFRunLoopDoSource0 + 76
    	23  CoreFoundation                      0x00007fff23bd3b74 __CFRunLoopDoSources0 + 180
    	24  CoreFoundation                      0x00007fff23bce87f __CFRunLoopRun + 1263
    	25  CoreFoundation                      0x00007fff23bce066 CFRunLoopRunSpecific + 438
    	26  GraphicsServices                    0x00007fff384c0bb0 GSEventRunModal + 65
    	27  UIKitCore                           0x00007fff48092d4d UIApplicationMain + 1621
    	28  Production                          0x000000010c1b1359 platform_UIKit_UIApplicationMain_wrapper64 + 89
    	29  Production                          0x000000010c10a7cb kfun:main(kotlin.Array<kotlin.String>) + 1371
    	30  Production                          0x000000010c10ab1c Konan_start + 156
    	31  Production                          0x000000010c17249f Init_and_run_start + 111
    	32  libdyld.dylib                       0x00007fff5227ec25 start + 1
    )
    libc++abi.dylib: terminating with uncaught exception of type NSException
    my code is inspired from KotlinFinder project ( https://github.com/JetBrains/KotlinFinder/blob/master/ios-app/src/iosMain/kotlin/Views/CollectWordView.kt )
    a
    4 replies · 2 participants
Powered by Linen
Title
g

gonzooin

01/08/2020, 2:42 PM
Hello, i’m trying to call addTarget on an UITextField but it crash at runtime. Kotlin code
init {
        uiView.searchTextField.addTarget(this, platform.darwin.sel_registerName("searchTextChanged"), UIControlEventEditingChanged)
    }

    @ObjCAction
    private fun searchTextChanged() {
        // some code 
    }
iOS Crash
2020-01-08 15:34:46.891004+0100 Production[69085:8719071] -[kobjcc0 searchTextChanged]: unrecognized selector sent to instance 0x6000036b1620
2020-01-08 15:34:46.897007+0100 Production[69085:8719071] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[kobjcc0 searchTextChanged]: unrecognized selector sent to instance 0x6000036b1620'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007fff23c7127e __exceptionPreprocess + 350
	1   libobjc.A.dylib                     0x00007fff513fbb20 objc_exception_throw + 48
	2   CoreFoundation                      0x00007fff23c91fd4 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
	3   CoreFoundation                      0x00007fff23c75c4c ___forwarding___ + 1436
	4   CoreFoundation                      0x00007fff23c77f78 _CF_forwarding_prep_0 + 120
	5   UIKitCore                           0x00007fff48093fff -[UIApplication sendAction:to:from:forEvent:] + 83
	6   UIKitCore                           0x00007fff47a6c00e -[UIControl sendAction:to:forEvent:] + 223
	7   UIKitCore                           0x00007fff47a6c358 -[UIControl _sendActionsForEvents:withEvent:] + 398
	8   UIKitCore                           0x00007fff4839655f -[UITextField fieldEditorDidChange:] + 202
	9   UIKitCore                           0x00007fff4837b53a -[UIFieldEditor textInputDidChange:] + 61
	10  UIKitCore                           0x00007fff483a6d45 -[UITextInputController _sendDelegateChangeNotificationsForText:selection:] + 104
	11  UIKitCore                           0x00007fff483a9628 -[UITextInputController _insertText:fromKeyboard:] + 765
	12  UIKitCore                           0x00007fff483aa07f -[UITextInputController insertText:] + 336
	13  UIKitCore                           0x00007fff4837ec97 -[UIFieldEditor insertFilteredText:] + 838
	14  UIKitCore                           0x00007fff4839c5e3 -[UITextField insertFilteredText:] + 93
	15  UIKitCore                           0x00007fff47ea906b -[UIKeyboardImpl insertText:] + 147
	16  UIKitCore                           0x00007fff47ea3863 -[UIKeyboardImpl _performKeyboardOutput:shouldCheckDelegate:] + 1059
	17  UIKitCore                           0x00007fff47ea24bd __55-[UIKeyboardImpl handleKeyboardInput:executionContext:]_block_invoke_2 + 372
	18  UIKitCore                           0x00007fff47ed1ab1 -[UIKeyboardTaskEntry execute:] + 147
	19  UIKitCore                           0x00007fff47ed05c7 -[UIKeyboardTaskQueue continueExecutionOnMainThread] + 310
	20  Foundation                          0x00007fff25781c30 __NSThreadPerformPerform + 259
	21  CoreFoundation                      0x00007fff23bd4471 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
	22  CoreFoundation                      0x00007fff23bd439c __CFRunLoopDoSource0 + 76
	23  CoreFoundation                      0x00007fff23bd3b74 __CFRunLoopDoSources0 + 180
	24  CoreFoundation                      0x00007fff23bce87f __CFRunLoopRun + 1263
	25  CoreFoundation                      0x00007fff23bce066 CFRunLoopRunSpecific + 438
	26  GraphicsServices                    0x00007fff384c0bb0 GSEventRunModal + 65
	27  UIKitCore                           0x00007fff48092d4d UIApplicationMain + 1621
	28  Production                          0x000000010c1b1359 platform_UIKit_UIApplicationMain_wrapper64 + 89
	29  Production                          0x000000010c10a7cb kfun:main(kotlin.Array<kotlin.String>) + 1371
	30  Production                          0x000000010c10ab1c Konan_start + 156
	31  Production                          0x000000010c17249f Init_and_run_start + 111
	32  libdyld.dylib                       0x00007fff5227ec25 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
my code is inspired from KotlinFinder project ( https://github.com/JetBrains/KotlinFinder/blob/master/ios-app/src/iosMain/kotlin/Views/CollectWordView.kt )
a

Andreas Jost

01/08/2020, 2:51 PM
Can you try NSSelectorFromString("searchTextChanged") instead of platform.darwin.sel_registerName? It's part of the platform.Foundation library.
g

gonzooin

01/08/2020, 2:52 PM
I’m trying 🙂
same error sadly
The problem was the method “searchTextChanged” wasn’t in a NSObject subclass !
👍 2
View count: 4