- Missing Swift Package Dependencies: Your Messages extension is missing critical package dependencies
- Xcode File Location Quirk: After moving files to work around an Xcode quirk, the project file needs path updates
- Wrong Assets Catalog: Messages extension was referencing the main app's Assets.xcassets instead of its own
- Missing Custom Colors: Custom colors (successGreen, failureRed) were not available in Messages extension
- Files Not in Sources Build Phase: Synchronized groups aren't adding files to Messages extension's compile sources
While the shared files have their target membership set correctly, the Messages extension is missing critical Swift Package dependencies:
Main app has these packages:
- CashuSwift ✅ (Messages extension has this)
- BIP39 ❌ (MISSING in Messages extension!)
- secp256k1 ❌ (MISSING - required by PersistentModelV1.swift)
- BigNumber (might be needed)
- Other packages (MarkdownUI, Popovers, etc.)
Messages extension only has:
- CashuSwift
The shared code requires:
import secp256k1(used in PersistentModelV1.swift for cryptographic operations)import BIP39(used in Operations/restore.swift if included)
This causes "missing symbol" errors during Archive builds because the packages aren't linked to the extension.
Since PersistentModelV1.swift imports secp256k1, the Messages extension MUST have these packages:
- Open your project in Xcode
- Select the
macadamiaMessagestarget (not the main app!) - Go to the "General" tab
- Scroll to "Frameworks and Libraries" section
- Click the "+" button
- Add these specific package products:
- secp256k1 (REQUIRED - PersistentModelV1.swift line 4 imports this)
- BIP39 (REQUIRED if restore.swift is included)
- BigInt (if your code uses BigNumber)
Why this is critical: Without secp256k1, PersistentModelV1.swift fails to compile, which means AppSchemaV1, Wallet, Mint, Proof, Event, and DatabaseManager are all undefined!
- Select the Messages extension target
- Go to "Build Phases" tab
- Expand "Link Binary With Libraries"
- Click "+" and add the missing package products
Check that these imports work in your Messages extension:
import secp256k1(required by PersistentModelV1.swift)import BIP39(if using restore functionality)
If you moved the Messages extension files to macadamia/macadamiaMessages/:
The project.pbxproj has been updated with:
- INFOPLIST_FILE paths:
macadamia/macadamiaMessages/Info.plist - Synchronized root group path:
macadamiaMessages(relative to parent group) - Removed incorrect Assets.xcassets reference (was pointing to main app's assets)
Assets Catalog Fix:
- The Messages extension was incorrectly using the main app's Assets.xcassets
- This caused "iMessage App Icon" not found errors
- Now uses its own Assets.xcassets from
macadamia/macadamiaMessages/Assets.xcassets - The synchronized root group automatically includes the correct assets
The Messages extension needs its own copy of custom colors used by shared code:
Custom colors copied to Messages extension:
successGreen.colorset- Green color for success statesfailureRed.colorset- Red color for error/warning states
These colors are now in macadamia/macadamiaMessages/Assets.xcassets/ and will be included automatically.
The synchronized file groups aren't working properly! The Messages extension's Sources build phase only includes Error.swift.
In Xcode, you need to:
- Select the
macadamiaMessagestarget - Go to Build Phases tab
- Expand Compile Sources
- You should see many files, not just Error.swift
If files are missing, manually add them:
- Click the "+" button in Compile Sources
- Add these files:
- All files from
PersistentModelV1folder (except restore.swift) ActionButton.swift,Currency.swift,TokenText.swift,Alerts.swift,MintPicker.swiftfrom MiscRedeemView.swift,LockedTokenBanner.swiftfrom Wallet/Redeem
- All files from
Alternative: Remove synchronized groups
- Select each folder (PersistentModelV1, Misc, Wallet) in project navigator
- File Inspector → Uncheck "Folder is under version control"
- Re-add files individually with proper target membership
- Clean Build Folder: Product > Clean Build Folder (⇧⌘K)
- Try archiving again: Product > Archive
If adding files causes other issues, try this temporary fix:
- Select the
macadamiaMessagestarget - Go to Build Settings tab
- Search for "Swift Compilation Mode"
- Change from "Whole Module" to "Incremental" for Release configuration
- This is less optimal but can help identify remaining issues
- Debug builds often work because they use incremental compilation and don't optimize as aggressively
- Archive/Release builds use whole module optimization which strips symbols not explicitly part of the target
- The Messages extension is a separate binary that needs its own copy of the code it uses
Consider creating a shared framework:
- Create a new Framework target called "MacadamiaCore"
- Move all shared code to this framework
- Link both the main app and Messages extension to this framework
- This ensures code is shared properly and reduces app size
After making changes, verify:
- Build succeeds for Debug configuration
- Archive succeeds for Release configuration
- Messages extension works correctly when installed
- ✅ Swift Package Dependencies - Add secp256k1 and BIP39 to Messages extension
- ✅ Info.plist Path - Updated to
macadamia/macadamiaMessages/Info.plist - ✅ Assets Catalog Path - Fixed to use extension's own Assets.xcassets
- ✅ Custom Colors - Copied successGreen and failureRed colorsets to extension
⚠️ Sources Build Phase - MUST manually add shared files to Compile Sources in Xcode
- Don't use
@testable importin production code - Ensure all dependencies of added files are also included
- Check that the App Group is properly configured for data sharing
- Verify entitlements match between app and extension
- Remember that extensions need their own copies of custom colors/assets