تصحيح مشكلات 'Shared Code Not Found'
حل أكثر مشكلات الربط شيوعًا عند التشغيل الأول
تصحيح مشكلات 'Shared Code Not Found' درس مجاني في Kotlin Multiplatform Academy على CoddyKit. هذا هو الدرس 4 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Kotlin Multiplatform Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Kotlin Multiplatform Academy 4 دروس في المجموع.
بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.
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:embedAndSignAppleFrameworkForXcodeCheck 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 sharedVerify 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 cleanPublic 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. 🎉
الأسئلة الشائعة
هل درس «تصحيح مشكلات 'Shared Code Not Found'» مجاني؟
نعم — نص درس «تصحيح مشكلات 'Shared Code Not Found'» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Kotlin Multiplatform Academy، انتقل إلى CoddyKit PRO. تتضمن دورة Kotlin Multiplatform Academy 4 دروس في المجموع.
ماذا ستتعلم في «تصحيح مشكلات 'Shared Code Not Found'»؟
حل أكثر مشكلات الربط شيوعًا عند التشغيل الأول تتمرن على Kotlin Multiplatform Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.
هل أحتاج إلى خبرة سابقة لأبدأ Kotlin Multiplatform Academy؟
لا تُشترط خبرة سابقة. Kotlin Multiplatform Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 4 من أصل 4.
كم من الوقت يستغرق درس «تصحيح مشكلات 'Shared Code Not Found'»؟
معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.
هل يمكنني كتابة وتشغيل أكواد في درس Kotlin Multiplatform Academy هذا؟
نعم. كل درس في Kotlin Multiplatform Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.
جميع الدروس في هذه الدورة
- تشغيل تطبيق Android من Studio
- فتح تطبيق iOS وتشغيله في Xcode
- كيفية إنشاء إطار iOS
- تصحيح مشكلات 'Shared Code Not Found'