iOS CocoaPods build fails: Package.swift included in sources causes No such module 'PackageDescription'
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 82/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- react-native
- Domain
- mobile
Research direction
The issue identifies the podspec source glob and ios/Package.swift as the cause. Read the podspec and inspect the generated Pods project’s Sources build phase to confirm the manifest is included. Done means CocoaPods excludes the manifest from library sources; the issue reports that pod install succeeds, but a full app rebuild is still unverified.
Written by the indexing model from the issue text.
Description
Description
An iOS app using react-native-background-actions 4.2.0 through CocoaPods fails to build in Xcode:
No such module 'PackageDescription'
Unable to resolve module dependency: 'PackageDescription'
Environment
- react-native-background-actions: 4.2.0
- React Native: 0.88.1
- Integration: CocoaPods
- App minimum iOS version: 15.5
- Package manager: Yarn 4.18.1
Steps to reproduce
- Install version 4.2.0 in a React Native iOS app using CocoaPods.
- Run
pod install. - Open the generated
.xcworkspaceand build in Xcode.
Expected behavior
CocoaPods should compile the library implementation without compiling the Swift Package Manager manifest.
Root cause
The podspec includes all Swift files directly under ios:
s.source_files = "ios/*.{h,m,swift}"
This also matches ios/Package.swift, which imports PackageDescription. Inspection of the generated Pods.xcodeproj/project.pbxproj confirmed that Package.swift was added to the library target's Sources build phase.
Suggested fix
Exclude the SwiftPM manifest in the podspec:
s.source_files = "ios/*.{h,m,swift}"
s.exclude_files = "ios/Package.swift"
Local verification
Applied this one-line change using a persistent Yarn patch and reran yarn install and pod install successfully. The regenerated Pods project no longer contains Package.swift as a source file. A full app rebuild has not yet been verified.
- Dominant language
- Java
- Stars
- 941
- Forks
- 145
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 3
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Rapsssito/react-native-background-actions
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 18/100
Rapsssito/react-native-background-actions#255 · 4 comments ·
-
enhancement help wanted
Difficulty 5/5 Over a week Newbie friendliness 20/100
Rapsssito/react-native-background-actions#249 · 16 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Rapsssito/react-native-background-actions#246 · 5 comments · 2 reactions ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
Rapsssito/react-native-background-actions#238 · 5 comments ·
All issues in Rapsssito/react-native-background-actions
Similar issues
-
bug verbose GC
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
IBM/javacore-analyser#677 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
liberation-data/fornax4j#302 ·
Maintainers usually reply within 1 day
-
needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 61/100
grimmory-tools/grimmory#3297 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
SmartPack/PackageManager#186 ·
-
Area: Java feature request needs triage OS: Windows
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
actions/runner-images#15457 ·
Maintainers usually reply within 3 days