spierce7
03/26/2020, 8:39 PMStableRef
to allow a frozen
object to hold onto a non-frozen object, so that I can create an object that I can create a wrapping object that provides an interface that’s responsible for ensuring access on the right thread.
This creates a memory leak though, as StableRef
has to be `dispose`ed when it’s done.
Is there any way to get around disposing StableRef
so that I don’t have to add a dispose()
fun on every single one of these interfaces?
Is there another way to do this without using StableRef
?napperley
03/27/2020, 12:42 AMspierce7
03/27/2020, 5:13 AMwithContext
calls.
This means that the wrapper will need to be frozen, and the core class that the wrapper delegates too will need to not be frozen. The wrapper has to have a reference to the core class though. How can I accomplish this? Someone mentioned using a StableRef
, which seems like it will do the job, but then it has to be disposed in order to not cause a memory leak for a reference. That means that a dispose
function has to be added to my wrapper. I’d like to not pollute my interface and require an API like that.
Is there another way?mbonnin
03/28/2020, 11:16 PMmacosX64Test
? I tried calling dispatch_main
manually but it gave me a Illegal instruction: 4
icarumbas
03/29/2020, 7:51 PMdarkmoon_uk
03/30/2020, 4:45 AMBrendan Weinstein
03/30/2020, 7:18 AMtasks.withType<KotlinCompile> {
kotlinOptions.freeCompilerArgs += "-Xobjc-generics"
}
instead of extraOpts("-Xobjc-generics")
, but I am seeing types returned as Any where I did not before. Any tips on the right way to enable generics for 1.3.71?Sylvain Patenaude
03/30/2020, 3:38 PMKris Wong
03/31/2020, 3:59 PMspierce7
03/31/2020, 5:27 PM__attribute__((objc_subclassing_restricted))
__attribute__((swift_name("RallyAbTestKt")))
@interface RATRallyAbTestKt : RATBase
+ (void)getExperimentGroup:(id<RATRallyAbTest>)receiver name:(NSString *)name callback:(void (^)(NSString *))callback __attribute__((swift_name("getExperimentGroup(_:name:callback:)")));
+ (void)doInit:(id<RATRallyAbTest>)receiver appName:(NSString *)appName userIdentifier:(NSString *)userIdentifier experiments:(NSArray<RATExperiment *> *)experiments mode:(RATAbTestMode *)mode callback:(void (^)(NSArray<RATExperimentGroup *> *))callback __attribute__((swift_name("doInit(_:appName:userIdentifier:experiments:mode:callback:)")));
@end;
The interop documentation shows that it should show up as an extension in Swift. Do I have to do something special to get that to work?Patrick
03/31/2020, 8:06 PMUnresolved reference: __builtin_va_list
?
I am not sure I understand why this error occurs. The generated Kotlin file has this import:
import platform.builtin.__builtin_va_list
, but that import does not exist. Does anyone know why this problem occurs or has any workaround for it?spierce7
04/01/2020, 3:20 AMMutabilityException
when using the native-mt
version of coroutines with Flow
. I’ve been stuck on this all day and it doesn’t make a ton of sense to me. I’ve re-created the issue on a small scale in the form of tests, one with the exception, one without. It’s difficult to tell if I’m being dense, or if there is a bug that I’m hitting.
For some reason the tests never complete when both are in the file. If you comment out test2
, run test1
, let it complete, and then check the stdout from the test, you’ll see the error. test1
has the exception, and test2
doesn’t.
https://gist.github.com/ScottPierce/0e687021f34d779708d1f32bfc81e8e2Vlad Balan
04/01/2020, 8:16 AMprotobuf
with Kotlin/Native
?
If anybody, can provide some useful links for this, I would be thankful.alex009
04/01/2020, 9:45 AMe: java.nio.file.NoSuchFileException: /Users/alex/Desktop/work_projects/my-project/dist/konan/konan.properties
?Euler
04/01/2020, 5:01 PMTask :BcLib:cinteropRUAIosDownloading native dependencies (LLVM, sysroot etc). This is a one-time action performed only on the first run of the compiler. Downloading dependency: https://download.jetbrains.com/kotlin/native/libffi-3.2.1-3-darwin-macos.tar.gz (72.6 kiB/72.6 kiB). Done. Extracting dependency: /Users/vnteumr/.konan/cache/libffi-3.2.1-3-darwin-macos.tar.gz into /Users/vnteumr/.konan/dependencies Downloading dependency: https://download.jetbrains.com/kotlin/native/clang-llvm-apple-8.0.0-darwin-macos.tar.gz (393.8 MiB/393.8 MiB). Done. Extracting dependency: /Users/vnteumr/.konan/cache/clang-llvm-apple-8.0.0-darwin-macos.tar.gz into /Users/vnteumr/.konan/dependencies e: /Users/vnteumr/workspace/bc-android/bc-kmp/BcLib/build/classes/kotlin/ios/main/BcLib-cinterop-RUA.klib-build/kotlin/com/ingenico/lar/bc/bc.kt: (31, 23): Unresolved reference: UIAxis e: /Users/vnteumr/workspace/bc-android/bc-kmp/BcLib/build/classes/kotlin/ios/main/BcLib-cinterop-RUA.klib-build/kotlin/com/ingenico/lar/bc/bc.kt: (1345, 78): Unresolved reference: UIAxis e: /Users/vnteumr/workspace/bc-android/bc-kmp/BcLib/build/classes/kotlin/ios/main/BcLib-cinterop-RUA.klib-build/kotlin/com/ingenico/lar/bc/bc.kt: (1437, 70): Unresolved reference: UIAxis It is very strange because the error happened when I was trying to generate a FatFramerkork. After the compile error, I rollback the changes I have done on gradle.build file . However, the error still happen after rollback. Then, I deleted all cache files (.gradle, .idea, .konan) and tried to build again. The same error happens. Have you faced this error? Do you know how to fix it?
spierce7
04/01/2020, 6:52 PM.framework
?spierce7
04/01/2020, 11:42 PMmbonnin
04/01/2020, 11:55 PM/usr/lib/libate.dylib
Peter Samokhin
04/03/2020, 12:31 AM1.3.71
, coroutines: 1.3.5-native-mt
, ktor: 1.3.2
.
Can someone explain to me, how is this working:
For now, this is not possible to do ktor calls in the background.
I know that this is ktor's issue, but only when you are calling HttpClient
from different threads on iOS (according to the github issues), and ktor handles this (does background calls) by itself.
In my case, I do such calls only before, but anyway I got InvalidMutabilityException
.
How this is possible?
A detailed description is below.
I have the code like this:
class IssueReproduce: CoroutineScope {
private val dispatcherUi = // on iOS: Dispatchers.Main
private val dispatcherDefault = // on iOS: Dispatchers.Default
private val job = SupervisorJob()
private val api = SomeApi()
override val coroutineContext = dispatcherUi + job
/* ... */
fun checkAuth() {
launch(coroutineContext) {
// make some call in a background BEFORE
val token = withContext(dispatcherDefault) {
repo.getToken()
}
val response = try {
api.doAuth(token)
} catch (e: Throwable) {
// error:
// kotlin.native.concurrent.InvalidMutabilityException
// mutation attempt of frozen io.ktor.client.request.HttpRequestPipeline@838cd448
}
}
}
}
Where:
class SomeApi {
private val client = HttpClient(/* ... */)
suspend fun doAuth(token: String): SomeDataClass {
return <http://client.post|client.post> {
url(/* ... */)
body = /* ... */
}
}
}
But, when I change code to this:
val token = /* withContext(dispatcherDefault) { */
repo.getToken()
/* } */
i.e. when I make no calls in the background before calling ktor.HttpClient, all is ok and there are no errors.
So, what I'm doing wrong? Removing withContext(dispatcherDefault)
for precending code does the trick, but wrapping ktor calls with withContext(coroutineContext)
or withContext(dispatcherUi)
does not.
How preceding code with the call in the background can affect the thread of the following code?
And how to fix this? As I mentioned above, I tried to wrap ktor calls with the original thread, but it does not help.Ian Stewart
04/03/2020, 1:37 PMspierce7
04/03/2020, 8:37 PMmbonnin
04/05/2020, 2:03 PM*.internal
package ?kzotin
04/07/2020, 12:11 PMStorage
and implementation of Storage
in android/swift module with actual models... Which quite boring!
Thanks in advance! 😉Lamberto Basti
04/07/2020, 1:14 PMmbonnin
04/10/2020, 12:55 AMspierce7
04/11/2020, 8:04 PM*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[RATExperiment initWithName:group:]: unrecognized selector sent to instance 0x600001180760'
redbassett
04/12/2020, 5:48 AMkotlin {
linuxArm32Hfp("projectname") {
[…]
}
sourceSets {
projectnameMain {
dependencies {
implementation 'com.example.package:artifact-name:0.0.0'
}
}
}
}
The string passed to implementation
is highlighted in IntelliJ with this warning:
‘implementation’ cannot be applied to ‘(java.lang.String)’Where do I put dependencies and how do I format them?
dazza5000
04/12/2020, 2:29 PMademar111190
04/12/2020, 7:08 PMArkadii Ivanov
04/12/2020, 9:54 PMArkadii Ivanov
04/12/2020, 9:54 PMsvyatoslav.scherbina
04/13/2020, 11:26 AMArkadii Ivanov
04/13/2020, 11:36 AMsvyatoslav.scherbina
04/13/2020, 11:46 AMArkadii Ivanov
04/13/2020, 12:04 PMKavan
04/14/2020, 12:31 PM