Marko Novakovic
12/20/2021, 4:11 PMPaul Weber
12/20/2021, 8:25 PMByteArray
on KotlinByteArray
in swift.
fun ByteArray.toUIImage(): UIImage = this.usePinned {
val nsData = NSData.create(bytes = it.addressOf(0), this.size.convert())
return UIImage(data = nsData)
}
I can’t see this function in Swift though.
Is this not possible or am I missing something?
How do you properly pass image data to swift from kotlin?William Persall
12/20/2021, 11:27 PMxxfast
12/21/2021, 6:16 AMEirik Vale Aase
12/21/2021, 10:12 AMThrows(Throwable:class)
and we log these errors to Crashlytics. Problem is, the error we get (when we cast it as an NSError) has a user info dictionary with a KotlinException entry, and it has a code of 0 and a domain of “KotlinException”. This causes all errors logged to crashlytics to be grouped under the same bucket. The Kotlin throwable has a message which looks something like this (this is formatted for readability, it’s still a string)
Exception in http request:
Error Domain=NSURLErrorDomain Code=-1009 "The Internet connection appears to be offline."
UserInfo={
_kCFStreamErrorCodeKey=50,
NSUnderlyingError=0x28035a940 {
Error Domain=kCFErrorDomainCFNetwork Code=-1009 "(null)"
UserInfo={
_NSURLErrorNWPathKey=unsatisfied (No network route),
_kCFStreamErrorCodeKey=50,
_kCFStreamErrorDomainKey=1
}
},
_NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <595E528B-8F59-4D85-88EE-DD084FC43CE7>.<1>,
_NSURLErrorRelatedURLSessionTaskErrorKey=(
"LocalDataTask <595E528B-8F59-4D85-88EE-DD084FC43CE7>.<1>"
),
NSLocalizedDescription=The Internet connection appears to be offline.,
NSErrorFailingURLStringKey=SOME URL,
NSErrorFailingURLKey=SOME URL,
_kCFStreamErrorDomainKey=1
}
I could try and parse this string, extract regex matches etc, but I was wondering if there is a better way. It seems like Kotlin packs all of the interesting stuff and concatenates their string representations and just stuffs it into the userInfo entry. I would very much have liked to get the actual error instance.
How do people handle this?breandan
12/21/2021, 9:36 PMSunil Kumar
12/22/2021, 4:13 PMError: Could not find or load main class org.gradle.wrapper.GradleWrapperMain
Caused by: java.lang.ClassNotFoundException: org.gradle.wrapper.GradleWrapperMain
Important point: What is different that i have seen from my previous project(which was working) is that inside new android project's shared/build/ directory, no xcode-frameworks and bin folders found there, these folders are not available there inside new project. I have been following everything from this link since the beginning for setting up the project:https://kotlinlang.org/docs/kmm-integrate-in-existing-app.html#connect-the-framework-to-your-ios-project. Guys Please help me with this. Struggling a lot with this. ThanksAnton Afanasev
12/22/2021, 9:37 PMPavel Gorgulov
12/23/2021, 2:37 PMPavel Repkin
12/23/2021, 6:27 PMJeff
12/26/2021, 7:17 AMPaul Weber
12/27/2021, 1:51 PMpod("Stripe")
to my build.gradle.kts
but now syncing the project fails with the task ':shared:cinteropStripeIosArm64'
producing the following error:
Exception in thread "main" java.lang.Error: /Users/paulweber/Development/Spenderino/shared/build/cocoapods/synthetic/IOS/shared/build/Release-iphoneos/Stripe/Stripe.framework/Headers/Stripe-Swift.h:722:10: error: no type or protocol named 'PKContactField'
at org.jetbrains.kotlin.native.interop.indexer.UtilsKt.ensureNoCompileErrors(Utils.kt:192)
I can use Stripe inside Xcode with this configuration, but building my shared kotlin module fails due to the aforementioned task failing.
I'm guessing this has something to do with the gradle task not having access to Apple's PassKit
which is however needed for compiling the Stripe pod?
Has someone successfully integrated Stripe in a KMM project or run into a similar error with cocoapods?tylerwilson
12/27/2021, 4:17 PMSolomon Tolu Samuel
12/28/2021, 2:18 PMFAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':shared'.
> The project must have a target for at least one of the following platforms: ios_simulator_arm64.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at <https://help.gradle.org>
BUILD FAILED in 415ms
** BUILD FAILED **
The following build commands failed:
PhaseScriptExecution [CP-User]\ Build\ shared /Users/tolusolomon/AndroidStudioProjects/MyApplication/build/ios/Pods.build/Debug-iphonesimulator/shared.build/Script-4552119A071AC6BAB7327E6434237EC3.sh (in target 'shared' from project 'Pods')
(1 failure)
Command PhaseScriptExecution failed with a nonzero exit code
And a build time error when i try to run the iosApp on Xcode:
"cannot find 'Greeting 'in scope"
and also this error
Failed to register bundle identifier (The app identifier "orgIdentifier.iosApp" cannot be registered to your development team because it is not available. Change your bundle identifier to a unique string to try again.)
please help out, thanksazemar
12/28/2021, 8:53 PMJohn O'Reilly
12/29/2021, 11:19 AMruntTest
in commonTest
tests? I have a basic test that tests flow which works if run for Android or JVM but for iOS target I'm getting following.
UncompletedCoroutinesError: After waiting for 60000 ms, the test coroutine is not completing
Alexander Suraphel
12/30/2021, 2:42 PM'pod install' command failed with code 1.
Error message:
Please, check that podfile contains following lines in header:
source '<https://cdn.cocoapods.org>'
How do fix this?Radoslaw Juszczyk
12/30/2021, 5:23 PMapi("org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlin_coroutines")
in a kotlin multiplatform project where
api("org.jetbrains.kotlinx:kotlinx-coroutines-core")
is inside commonMain
?spierce7
12/30/2021, 5:27 PMbrabo-hi
12/31/2021, 1:41 AMspierce7
12/31/2021, 4:03 PMiosSimulatorArm64()
target part of the ios()
target yet? Same for tvosSimulatorArm64()
and tvos()
.Solomon Tolu Samuel
01/01/2022, 8:46 PMval iosX64Main by getting
val iosArm64Main by getting
val iosSimulatorArm64Main by getting
val iosMain by creating {
dependsOn(commonMain)
iosX64Main.dependsOn(this)
iosArm64Main.dependsOn(this)
iosSimulatorArm64Main.dependsOn(this)
dependencies{
implementation(Dep.Ktor.ios)
}
}
And this is the error i get:
BUILD FAILED in 3s
7 actionable tasks: 2 executed, 5 up-to-date
Command PhaseScriptExecution failed with a nonzero exit code
* BUILD FAILED *
The following build commands failed:
PhaseScriptExecution [CP-User]\ Build\ shared /Users/tolusolomon/AndroidStudioProjects/Link/build/ios/Pods.build/Debug-iphonesimulator/shared.build/Script-
(1 failure)darkmoon_uk
01/02/2022, 11:06 AM17238
→ 17.24 kB
? Must include JS.
Used Package Search but nothing came up 🤷Solomon Tolu Samuel
01/02/2022, 5:25 PMFAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':shared'.
The project must have a target for at least one of the following platforms: ios_simulator_arm64.The following build commands failed: PhaseScriptExecution [CP-User]\ Build\ shared /Users/tolusolomon/AndroidStudioProjects/Link/build/ios/Pods.build/Debug-iphonesimulator/shared.build/Script-882AF45D8B8C4938AC461F4FBA0FE197.sh (in target 'shared' from project 'Pods') (1 failure) Command PhaseScriptExecution failed with a nonzero exit code
rkechols
01/02/2022, 6:28 PMdarkmoon_uk
01/03/2022, 11:24 AMxxfast
01/03/2022, 8:50 PMKaushalya
01/04/2022, 2:25 AMRohan Maity
01/04/2022, 5:19 AMcomposable
shared multiplatform module, inside that I have put some compose libraries as commonMain
Android app runs fine, but when I try to run ./gradlew jsBrowserRun
it fails to resolve all the compose dependenciesmzgreen
01/04/2022, 5:57 PMnativeMain
target. I did this:
val commonMain by sourceSets.getting
val commonTest by sourceSets.getting
val nativeMain by sourceSets.creating
nativeMain.dependsOn(commonMain)
targets.withType<org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget>().all {
val mainSourceSet = compilations.getByName("main").defaultSourceSet
val testSourceSet = compilations.getByName("test").defaultSourceSet
mainSourceSet.dependsOn(nativeMain)
testSourceSet.dependsOn(commonTest)
}
I also added Okio
library as a dependency in commonMain
.
Now I'm trying to use Okio in a kotlin file inside nativeMain
directory but it doesn't work. Looks like the dependency is not being correctly picked up.
If instead of creating this custom nativeMain
source set I just use a single one like macosX64
and then put my kotlin file inside macosX64
directory then I can use the Okio and it works fine.
What am I doing wrong that the dependency doesn't work in my custom nativeMain
source set?mzgreen
01/04/2022, 5:57 PMnativeMain
target. I did this:
val commonMain by sourceSets.getting
val commonTest by sourceSets.getting
val nativeMain by sourceSets.creating
nativeMain.dependsOn(commonMain)
targets.withType<org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget>().all {
val mainSourceSet = compilations.getByName("main").defaultSourceSet
val testSourceSet = compilations.getByName("test").defaultSourceSet
mainSourceSet.dependsOn(nativeMain)
testSourceSet.dependsOn(commonTest)
}
I also added Okio
library as a dependency in commonMain
.
Now I'm trying to use Okio in a kotlin file inside nativeMain
directory but it doesn't work. Looks like the dependency is not being correctly picked up.
If instead of creating this custom nativeMain
source set I just use a single one like macosX64
and then put my kotlin file inside macosX64
directory then I can use the Okio and it works fine.
What am I doing wrong that the dependency doesn't work in my custom nativeMain
source set?Paul Woitaschek
01/04/2022, 5:57 PMmzgreen
01/04/2022, 6:01 PMkpgalligan
01/04/2022, 6:24 PM