◉CLAUDE LABJP
●2.1.296 — Subagents can set their own autoCompactWindow, and an env var pins the model used by workflow agents●AGENTS — Managed Agents gain dynamic workflows in beta: an agent can build a run for work with many pieces (Oct 9)●SONNET 4.5 — Retires on the Claude API on 11/30, 49 days left. Migrate to Sonnet 5.5●Q&A — A write-up shows that handing over only a bug report gets fixes confined to the tests; scoping the request is the point●HAIKU 5.5 — Code written for Haiku 4.5 hits a 400 error on budget_tokens●NEW — Stop making it reread the whole notes file: look up one section by number●2.1.296 — Subagents can set their own autoCompactWindow, and an env var pins the model used by workflow agents●AGENTS — Managed Agents gain dynamic workflows in beta: an agent can build a run for work with many pieces (Oct 9)●SONNET 4.5 — Retires on the Claude API on 11/30, 49 days left. Migrate to Sonnet 5.5●Q&A — A write-up shows that handing over only a bug report gets fixes confined to the tests; scoping the request is the point●HAIKU 5.5 — Code written for Haiku 4.5 hits a 400 error on budget_tokens●NEW — Stop making it reread the whole notes file: look up one section by number
Articles/Claude Code
⟐ Claude Code/2026-10-12Intermediate

After Moving to SPM, My App Died the Moment It Launched — Reading One dyld Line with Claude Code

Right after moving from CocoaPods to Swift Package Manager, the build passed but the app died on launch. Here is how I traced one dyld line to its cause, the fix, and how to verify it.

Claude Code260SPMdyldiOS26indie dev11troubleshooting92

I had just finished moving one of my wallpaper apps from CocoaPods to Swift Package Manager. The build was green, and the warnings were what I expected. I pressed Run on the simulator, the launch screen flashed for a moment, and I was dropped back on the home screen.

No crash dialog. No red line. Only when I opened the Xcode console did I find a single unfamiliar line:

dyld[1234]: Library not loaded: @rpath/AppLovinSDK.framework/AppLovinSDK
  Referenced from: <...> /MyApp.app/MyApp
  Reason: tried: '/usr/lib/system/introspection/AppLovinSDK.framework/AppLovinSDK' (no such file), ...

It compiled, yet something stopped it before it could even start. I want to write down how I read that line and what I changed, in case it saves someone else half a day.

How to recognize this failure

First, this is not a bug in your code. If all three of these are true, suspect this one:

  • Build and link succeed
  • The app dies at launch, before the first line of AppDelegate runs
  • The only trace is a dyld line in the console

In my setup, Crashlytics received nothing. That makes sense, since the process stops before any SDK is initialized. The quiet dashboard nearly convinced me nothing was wrong.

What was actually happening

Under CocoaPods, the Podfile decided how each SDK was brought in. With SPM, that decision splits into how the package is delivered and how the target is configured. This SDK ships as a dynamic framework, and a dynamic framework is found at launch only when two things hold:

  1. Its binary is embedded in the app's Frameworks folder
  2. The runtime search path includes that folder

My project referenced the SDK only through an ad adapter package and never linked it directly from the app target. That indirect reference is the trap: the build passes, but the framework is left out of what gets embedded.

What I handed to Claude Code, and what I didn't

project.pbxproj runs to thousands of lines, and pasting all of it would waste context. I gave Claude Code just two things:

# Resolved dependencies (which packages, which products)
grep -n "productName" MyApp.xcodeproj/project.pbxproj
 
# The runtime search path setting
grep -n "LD_RUNPATH_SEARCH_PATHS" -A3 MyApp.xcodeproj/project.pbxproj

Along with the dyld line, I added: "Build succeeds, dies right before launch. I suspect dynamic framework embedding or the runpath." The answer pointed at two things: the SDK wasn't linked directly from the app target, and LD_RUNPATH_SEARCH_PATHS lacked @executable_path/Frameworks.

That matched my hunch, but having the order of checks laid out kept me moving. Claude Code only helped me decide where to look. The builds and the on-device checks stayed with me in Xcode.

The fix (Before / After)

Three places needed attention.

# 1. Link the SDK directly from the app target
- (referenced only indirectly, through the adapter)
+ Add AppLovin-MAX-Swift-Package under Package Dependencies, then add
+ AppLovinSDK to the target's Frameworks, Libraries (Embed & Sign)
 
# 2. Runpath Search Paths in Build Settings
- LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"   <- was missing
+ LD_RUNPATH_SEARCH_PATHS = (
+     "$(inherited)",
+     "@executable_path/Frameworks",
+ );

I added the direct dependency first and checked the search path second. Fixing the path alone does nothing if the framework was never embedded.

Verify it with your own eyes

"It launched, so it's fixed" isn't enough. Look inside the build product. Two lines are all it takes:

APP="$HOME/Library/Developer/Xcode/DerivedData/<project-hash>/Build/Products/Debug-iphonesimulator/MyApp.app"
 
ls "$APP/Frameworks"                       # is AppLovinSDK.framework listed?
otool -l "$APP/MyApp" | grep -A2 LC_RPATH  # does @executable_path/Frameworks appear?

If the binary is in Frameworks and LC_RPATH shows the path, the app can find it at launch. Only after seeing both did I relax.

If it still fails

What you seeWhere to look first
Library not loaded now names a different frameworkIs that framework also only referenced indirectly?
The binary is in Frameworks but it still diesIs LC_RPATH empty, or overridden by another value?
Works on the simulator, dies on a deviceSigning and embed mode (Embed & Sign vs. Do Not Embed)
Stuck at dependency resolutionRun xcodebuild -resolvePackageDependencies first

For me, this migration did not finish in one pass. I went around the build-and-fix loop about seven times. It helps to assume a single clean pass is unlikely.

The line I drew

My mistake was treating "the build passes" and "the app launches" as the same thing.

A green build is the doorway; launching is what finishes the job.

For this migration, I now call it done only after checking Frameworks and LC_RPATH in the built product, not when the build succeeds.

If you're about to do the same migration, try those two commands before your first run. If you can see the binary and the search path there, most of that lost half day should disappear.

Share

Thank You for Reading

Claude Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $15 for lifetime access
View Membership →

If you found this article helpful, a small tip ($1.50) would mean a lot to us. Your support helps keep this site ad-free and covers server and hosting costs.

Related Articles

⟐ Claude Code2026-10-05
I Wrote "I'll Do the Commits" in CLAUDE.md. The Next Morning git log Had One More Line.
When Claude Code commits despite being told not to: undo with git reset --soft, then stop it physically with permissions.deny plus a PreToolUse hook. Covers the git -c form that deny rules let through, and how to test the hook without starting Claude Code.
⟐ Claude Code2026-09-04
The One File I Keep Out of Claude Code's Reach: project.pbxproj
With Xcode project files, the breakage that still opens costs far more than the breakage that refuses to open. Here is what I measured before moving every edit behind a script, and where the line sits today.
⟐ Claude Code2026-08-30
Your Config Asks for effort xhigh With Thinking Off, and It Now Quietly Runs at high
Disabling thinking while asking for effort xhigh or max returns a 400. That failure now degrades silently to high instead, so here is a small preflight that catches the mismatch before you send the request.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links