Hi guys, how to get the latest version of my iOS a...
# multiplatform
z
Hi guys, how to get the latest version of my iOS app from the App Store. in jet pack compose Kotlin multiplatform. Is it really hard to do it? I spent two days on it and I'm still blocked.
c
I spent two days on it and I’m still blocked.
what blocks you? what issues are you seeing? Help others, help you! 😉
z
I want to check if there is an update. And try to get the last version of my app in App Store. I'm looking how to get this info in Kotlin compose multiplatform.
c
that has noting to do with compose. check the iOS API if there is anything like that available.
z
Yes, I'm looking for something similar to android
Copy code
task.addOnSuccessListener { info ->
    if (info.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE) {
but for IOS
c
yes. dig through the ios or app store conntect apis 🤷🏻 I don’t see anything that is related to kotlin and compose here.
“Let me Google that for you”:
z
I'm new in KMM maybe my question is not very clear
This is my first compose multi platform project. I'm trying to do the In APP update. For android side it's done. but for iOS I'm blocked how to get the last version of my app in App Store. Programmatically.
c
yes, and the first answer in the SO link gives you an idea on how to do it. KMP will not provide this for you. Android is native and you will have to do it natively in iOS as well.
z
thanks for the link but its for Swift not Kotlin
c
you can use expect/actual to create a bridge from android/ios to KMP. https://www.jetbrains.com/help/kotlin-multiplatform-dev/multiplatform-expect-actual.html
z
Yes I do. and I implement the actual function for android but getting problems to implement the actual function in iOS.
c
translate the swift code to kotlin. use a llm if you cannot do it on your own. its just a rest request to an API and read bundle values for the actual version.
z
Yes, I tried to do it with iTunes API via NSURLSession but get errors some functions not recognised in compose
🤷🏻‍♂️ 1
c
I’ll jump off now - you are not providing any information/context/code-snippets/“what did I try already”/“what is not working” and making it very hard for others to help you. Good luck with your project! 🤞🏻
🙈 1
z
https://developer.apple.com/documentation/appstoreconnectapi/get-v1-appstoreversions-_id_ This is the API that I try to use. But didn't find any example code helping how to use it.
c
again you are not providing any information on whats going wrong with your request 😅 did you read this?
Calls to the API require JSON Web Tokens (JWT) for authorization; you obtain keys to create the tokens from your organization’s App Store Connect account. See Creating API Keys for App Store Connect API to create your keys and tokens.
https://developer.apple.com/documentation/appstoreconnectapi
z
Thanks for your help and Sorry if my question sounds unclear — I'm a beginner🥲
Is it really hard to just get simply the latest version of my iOS app in App Store?
s
You can use Ktor to call HTTP APIs in Kotlin Multiplatform: https://ktor.io/docs/client-create-and-configure.html. For the iOS platform, you'll want the Darwin engine.
🙌 1
In addition to the HTTP client, you'll need to understand how to authenticate to the Apple API, and what to extract from the response. There's links previously in the thread for all of that. You likely won't find a full copy/paste example in Kotlin of calling this specific API. You can probably find examples in Kotlin of how to make HTTP calls (in general) with Ktor, and perhaps examples in other languages of how to call this particular API. An LLM will probably be able to piece together the documentation links here into some working example for you.
If you need any more detailed help, well you'll need to share exactly: • What did you try (with code snippets!) • What was the outcome (with exact compiler or runtime errors!)
Is it really hard to just get simply the latest version of my iOS app in App Store?
It's not hard if you understand what it means to "make an authenticated HTTP GET call to the App Store API and parse the JSON response body". If you don't, yes it's hard. In that case, it's probably worth investing some time in foundational skills before tackling this particular problem
z
Your are right! thanks a lot for your response. I will use your keys info to find the solution.
Thanks a lot Sargun Vohra you really gave me the key to solve my problem. I fix it.
🎉 1