https://kotlinlang.org logo
Title
a

AmrJyniat

03/17/2023, 2:35 PM
I’ve a problem when running a KMM project on IOS simulator, always gives me the following error:
** BUILD FAILED **
The following build commands failed:
	PhaseScriptExecution Run\ Script /Users/ultimate/KMMProjects/OrdersDelivery/build/ios/iosApp.build/Debug-iphonesimulator/iosApp.build/Script-7555FFB5242A651A00829871.sh (in target 'iosApp' from project 'iosApp')
(1 failure)
I think it’s a trivial issue, anyone knows what’s the cause of this problem?
p

Pablichjenkov

03/17/2023, 3:05 PM
There is a script in xcode build phases that compiles the kotlin sources before building the swift side. That script is failing, the logs don't give more info. Are you running it from xCode or AS? Are you using cocoapods?
a

AmrJyniat

03/17/2023, 3:05 PM
I don’t use cocoapods
p

Pablichjenkov

03/17/2023, 3:07 PM
Ok, what happens when you run the gradle tasks
assembleXCFramework
?
a

AmrJyniat

03/17/2023, 3:19 PM
I added
XCFramework
and synced, but didn’t find the
assembleXCFramework
task in the gradle tasks
p

Pablichjenkov

03/17/2023, 3:20 PM
Open and close AS/IJ clean cache, you know the typical stuff, you should see it.
Or more specific, check what task is set to run in the phase script that fails
a

AmrJyniat

03/17/2023, 3:23 PM
Ok, I’ll try, one more question, should I add
XCFramework
stuff on each project works with regular framework to make it works on IOS?
p

Pablichjenkov

03/17/2023, 3:26 PM
The guidelines instruct you to do that, specific for xcframework. Not sure how regular frameworks works.
Have you seen a gradle task that generates a regular framework and not an xcframework?
a

AmrJyniat

03/17/2023, 3:27 PM
After invalidate and restart AS, I tried to rebuild the project and the following error appears:
e: Could not find "org.jetbrains.kotlin.native.platform.CoreFoundationBase" in [/Users/ultimate/KMMProjects/OrdersDelivery, /Users/ultimate/.konan/klib, /Users/ultimate/.konan/kotlin-native-prebuilt-macos-aarch64-1.7.20/klib/common, /Users/ultimate/.konan/kotlin-native-prebuilt-macos-aarch64-1.7.20/klib/platform/ios_arm64]
p

Pablichjenkov

03/17/2023, 3:27 PM
I have only seen for xcframework and cocoa
Try opening the iOS project with xCode. Ensure the kotlin multiplatform plugin is applied correctly. Give it sometime, maybe is fetching dependencies since you clear/invalidate all
a

AmrJyniat

03/17/2023, 6:40 PM
All those steps are applied since I used multiplatform plugin when created the project
p

Pablichjenkov

03/17/2023, 8:32 PM
I see, on my experience, I use compose-multiplatform with cocoapods. There is a couple of templates that you pull from github and it just work. I would say, try to find a working template on github that best suits your needs, either kmm or compose-multiplatform and start building on top of it.
I think that is the easy way to get you started rather than following a tutorial/guideline that may be outdated with the current stage of the project
a

AmrJyniat

03/17/2023, 9:25 PM
You’re right, Thank you for helping!