Run 32-bit apps on macOS Catalina (10.15) and Big Sur (11.0).
First install homebrew brew.sh
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"| import kotlinx.cinterop.memScoped | |
| import kotlinx.cinterop.allocArrayOf | |
| import kotlinx.cinterop.addressOf | |
| import kotlinx.cinterop.usePinned | |
| import platform.Foundation.NSData | |
| import platform.Foundation.create | |
| import platform.posix.memcpy | |
| public fun ByteArray.toData(): NSData = memScoped { | |
| NSData.create(bytes = allocArrayOf(this@toData), | 
Run 32-bit apps on macOS Catalina (10.15) and Big Sur (11.0).
First install homebrew brew.sh
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"| ktorHttpClient.post("xxxx") { | |
| tryCompress(this, json) | |
| } | |
| private fun tryCompress(httpRequestBuilder: HttpRequestBuilder, json: JSONObject) { | |
| val stringBody = tryCreateRequestBody(json = json) | |
| if (stringBody.length > 4096) { | |
| httpRequestBuilder.body = stringBody.gzipCompress() | |
| httpRequestBuilder.headers[HttpHeaders.ContentEncoding] = "gzip" | |
| } else { |