0Pricing
Kotlin Multiplatform Academy · Lección

Depuración de problemas de «Shared Code Not Found»

Resuelva los problemas de enlace más comunes del primer arranque

Depuración de problemas de «Shared Code Not Found» es una lección gratuita de Kotlin Multiplatform Academy en CoddyKit. Esta es la lección 4 de 4. Puedes leer la lección completa abajo gratuitamente — luego la practicas en el navegador con un editor de código integrado y un tutor de IA 24/7. Forma parte de la ruta de aprendizaje de Kotlin Multiplatform Academy, y tu progreso se sincroniza en la web y la app de CoddyKit. El curso de Kotlin Multiplatform Academy incluye 4 lecciones en total.

Partes de esta lección aún no han sido traducidas y se muestran en inglés.

The Classic First-Run Wall

Almost everyone hits it once: iOS builds but Swift cannot find your shared API. Let's debug shared code not found calmly. 🛠️

Confirm the Framework Built

First, run the Gradle framework task directly. If it fails outside Xcode, the framework never existed and Swift had nothing to link.

./gradlew :shared:embedAndSignAppleFrameworkForXcode

Check the import Name

Swift must import the exact baseName set in build.gradle.kts. A mismatched name is the most common no-such-module error.

import shared

Verify the Build Phase Order

The Gradle build phase must run before Compile Sources. If it sits too low in the list, Swift compiles before the framework exists.

Framework Search Paths

Xcode needs to know where the framework lives. Check that Framework Search Paths points at the Gradle output folder for your target.

Open the Right File

Using CocoaPods but opened the .xcodeproj? Pods are missing. Close it and open the .xcworkspace instead.

Wrong Architecture Linked

An arm64 framework will not link into an x86 simulator. Make sure the framework was built for the same architecture as your run target.

Read the Build Log Top-Down

Expand the failing step in the build log and find the first error. A later linker complaint is often just a symptom of an earlier failure.

Clean Out Stale Output

Old artifacts can confuse the linker. A clean Gradle build plus an Xcode clean often clears a stubborn not-found error.

./gradlew clean

Public API Visibility

Only public Kotlin declarations cross to Swift. If a class is internal, Swift will not see it no matter how the framework links.

Most Fixes Are Wiring, Not Logic

These errors look scary but are almost always config: name, path, order, or architecture. Check those four and you'll be unblocked. ✨

Quick Check

Let's confirm a frequent cause of this error.

Recap

You learned to debug not-found errors by checking the framework built, the import name, build-phase order, search paths, and architecture. Most fixes are config, not code. 🎉

Preguntas frecuentes

¿La lección «Depuración de problemas de «Shared Code Not Found»» es gratis?

Sí — el texto completo de «Depuración de problemas de «Shared Code Not Found»» es gratis para leer aquí en la web. Para practicarla de forma interactiva (editor de código integrado y tutor de IA 24/7) y desbloquear el resto del curso de Kotlin Multiplatform Academy, actualiza a CoddyKit PRO. El curso de Kotlin Multiplatform Academy incluye 4 lecciones en total.

¿Qué aprenderé en «Depuración de problemas de «Shared Code Not Found»»?

Resuelva los problemas de enlace más comunes del primer arranque Practicas Kotlin Multiplatform Academy con código real que ejecutas directamente en el navegador, y un tutor de IA 24/7 responde tus preguntas mientras trabajas en la lección.

¿Necesito experiencia previa para empezar Kotlin Multiplatform Academy?

No se requiere experiencia previa. Kotlin Multiplatform Academy en CoddyKit está estructurado para principiantes hasta estudiantes avanzados, así que puedes empezar aquí o desde el inicio y avanzar a tu ritmo. Esta es la lección 4 de 4.

¿Cuánto tiempo toma la lección «Depuración de problemas de «Shared Code Not Found»»?

La mayoría de las lecciones de CoddyKit toman alrededor de 5–10 minutos. Cada una es compacta e interactiva, así que avanzas constantemente y retomas exactamente por donde dejaste en la web y la app.

¿Puedo escribir y ejecutar código en esta lección de Kotlin Multiplatform Academy?

Sí. Cada lección de Kotlin Multiplatform Academy incluye un editor de código integrado, así que escribes y ejecutas código real directamente en tu navegador y obtienes retroalimentación instantánea de IA — sin configuración local necesaria.

Todas las lecciones de este curso

  1. Ejecute la aplicación Android desde Studio
  2. Abra y ejecute la aplicación iOS en Xcode
  3. Cómo se compila el framework de iOS
  4. Depuración de problemas de «Shared Code Not Found»
← Volver a Kotlin Multiplatform Academy