No Such Module 'Alamofire','SwiftyJson','UiKiT' - ios

I am getting this build error on an existing project when I try to build project.
no such module 'Alamofire'
When I remove that line, then it start point to swiftyJson as
no such module 'SwiftyJson'
and when i remove that line and build again it start pointing UiKit as
no such module UiKit
Yesterday, I updated my xcode to 10.3 as I got a new update so installed that and after that I am getting this issue.
Then I downloaded previous version xcode 10.2.1 from apple developer site and now again I am getting this issue.
When I make a new project there is no issue like this.
i have tried reinstalling pods after some sort of search but not getting rid of this error.

delete derived data: go to Xcode -> preferences -> Locations -> then delete derived data
if that doesn't work try restarting your mac

Clean the project with 'command + shift + K'
or
if your project is uploaded in git repository, just remove whole project to trash and clone it

Related

importing "Module 'app_settings'" not found

I'm currently trying to work with xcode to test my flutter application with xcode. The big issue is that all of my imports (such as app_settings, cloud_firestore, etc...) give an error for "Module ___ not found". When I try to run my dart code I get the error in the terminal:
[Proj Root]/ios/Runner/GeneratedPluginRegistrant.m:10:9: fatal error: module 'app_settings' not found
#import app_settings;
~~~~~~~~^~~~~~~~~~~~
1 error generated.
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
I tried running flutter create for ios, (this might've made things worse?) Flutter clean and reinstalling pods doesn't seem to work either. I'm wondering if there's something simple that I missed with importing modules. I created the application on android using modules that should work with Android & iOS. After getting the android version working I pulled my project on my mac through github and finally reached this issue. Any pointers would be appreciated because I'm totally stuck on this.
My project has 3 build flavor. Development, Staging & Production.
In Xcode It was selected default Runner One. (On Top of the middle)
though i follow the process like
delete pod , Podfile.lock and .symlinks from Android Studio / (From Project)
flutter pub get
cd ios > pod install
Then In XCode > clean build
Select Right Build Flavor (Production For Me)
Then Archive (Done)
NB: I tested in M1 machine.
Hmm Not sure what happened but it seems to be good now. I think pod init was initializing minimal data for the podfile. Instead, I deleted the Pods file and did flutter run and it built the podfile correctly with flutter pub get.
Had the same problem, we solved it by setting the iOS Deployment target in XCode to the same value as set in the Podfile, which was 12.0. Then ran flutter clean and flutter build ios worked like a charm 🎉
I had this same problem. What I did was
Delete the Podfile and Podfile.lock
flutter clean
flutter build ios
Opened the Runner.xcworkspace
Build on Xcode
This worked for me 🎉
Delete pod directory and podfile.lock
flutter clean
flutter pub get
cd ios
pod install --repo-update
run the application in Xcode
I tried everything above, but for me the solution was quite different.
I am using flavors (schemes), and I accidentally created the scheme with upper case in the first character, while everywhere else (build config etc.) I used lower cases only. After deleting the scheme and recreating with lower case characters, it worked.
path/flutter/ios/Runner/GeneratedPluginRegistrant.m:12:9: Module 'app_settings' not found
I had the same issue after upgrading the Xcode to 13.3 and my production build flavor wasn't working. I was using firebase as well. In my production build flavor, I didn't append anything to the configuration name (i.e. all the other configurations have the name like "Debug-staging", "Debug-development", but in the production, it's only "Debug"). I just deleted the pod file and run:
flutter run --flavor production --target lib/main_production.dart
Everything worked fine for me.

Xcode 11.4 compile error 'Missing package product <package name>'

When I integrate a local package in my Xcode project everything is fine initially but when i switch branches and want to run the app Xcode gives me the compile error Missing package product <package name>. When I quit Xcode and re-open it everything is fine again. Any idea what this can be? An Xcode bug?
We also integrate external packages via Swift Package Manager which works perfectly fine. No issues there.
The issue is also well described in a post by Jesse Squires.
Solution 1: File > Swift Packages > Reset Package Caches
Solution 2: File > Swift Packages > Update to Latest Package Versions
For me, I needed File > Swift Packages > Reset Package Caches
In Xcode go to File > Swift Packages > Update to Latest Package Versions
Worked for me
In Xcode go to Product > Clean Build Folder
This worked for me. The problem originally started when I was trying to solve another issue that came up after I deleted my Derived Data folder.
Restarting Xcode didn't work, but cleaning the build folder did. I don't know if the other answers here would work for me because I didn't try them seeing as cleaning the build folder worked.
I bumped into this issue today on Xcode 13.0 when working on the WooCommerce iOS app after manually deleting the DerivedData folder.
The build was failing like in the questions description: Missing package product '<package name>'
I tried both resetting the packages cache and updating to the latest versions, but neither work. Thinking about it, that's not surprising since the packages Xcode couldn't find were local packages.
What did the trick for me was following this suggestion from an Apple forums thread and remove the local packages references, then adding them back again.
In WooCommerce's case, the local packages are part of a workspace file. Removing then adding them back again in the same order didn't result in a diff in the file. That is, nothing really changed in the workspace setup, but that was apparently the kind of kick Xcode needed to get over that error. 🤷‍♂️
I'm not sure of the root cause, but I get this quite regularly. Not the most elegant solution, but neither Reset Package Caches nor Update to Latest Package Versions worked for me. For me, I had to quit Xcode, and delete DerivedData.
rm -rf ~/Library/Developer/Xcode/DerivedData/*
Then rebuild.
None of the answers worked for me on Xcode 12.5 beta. I had to manually remove all spm packages and re add them.
SPM - Reset Package Caches vs Update to Latest Package Versions
File -> Swift Packages -> Reset Package Caches
File -> Swift Packages -> Update to Latest Package Versions
Update to Latest Package Versions
fetch the latest possible version(based on restrictions)
Reset Package Caches
reset cache(derived folder) -> Update to Latest Package Versions
folder
<path_to_derived_data>/<randomizer>/SourcePackages/checkouts/<project_name>
//e.g
/Users/alex/Library/Developer/Xcode/DerivedData/SPM-dpsmlyjrashqjefkfheppizcrgic/SourcePackages/checkouts/SPMExperiments
[Local SPM]
I tried:
Clean project
Clean derived data
Resolve Package Versions (File > Package)
Update to Latest Package Versions (File > Package)
Restart Xcode
Restart Mac
And restarting the Mac is what worked 🥲
Others say doing "Resolve Package Versions" multiple times also work.
I got this error when having the same local Swift package open in two different instances of Xcode in two different projects. Got it working again by quitting Xcode and only having one project open at a time.
A workaround for me at the moment has been both running Product > Clean Build Folder (cmd-k) and then restarting Xcode. This is an issue in both Xcode 12.4 and 12.5, and 12.5's per user package caching did not resolve the issue.
File > Swift Packages > Reset Package Caches also appears to work but it is slower for me.
Context:
One of my vendors distributes their pre-compiled binary library via SPM. Whenever I switch between git development branches, I get:
"artifact of binary target 'xyz' failed extraction: The operation couldn’t be completed. (TSCBasic.StringError error 1.)"
It also causes these "missing package product" errors for totally unrelated packages presumably because if one package fails the whole SPM process fails ("resolving package graph failed") even if these package are entirely independent.
Edit: With Xcode 12.5 simply quitting Xcode and re-opening seems to be enough.
Start with the other answers like
Reset Package Caches
Product > Clean Build Folder
If this doesn't help...
In my messages I found a hint that I had a dependency to two different version of the same package.
After fixing this, Reset Package Caches suddenly worked for most of my packages.
I could fix the remaining problems by adding
platforms: [
.iOS(.v13),
],
to the corresponding package. Before that, I had no platforms statement.
Xcode Source Control should be enabled to run this.
Preference -> Source Control and enable the source control.
If none of the above answers work, Please refer the solution shared by GravityBytes in this link on Apple Forums.
Eventually he happened to share the below resolution
I eventually got this resolved. What seemed to get it working was re-adding my local packages using the "Add Packages…" menu option on the project that has the framework targets using the local package. This created a new "Packages" group in the project, and eventually started compiling correctly.
Please remove the existing references and try adding them using the above approach.
Just a silly question: did you set up your git account on Xcode preferences?
For Moya I had to edit project file to Xcode heart's content
/* XCRemoteSwiftPackageReference "Moya" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/Moya/Moya";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 13.0.2;
};
anything other than 13.0.2 results in unresolutio for the numerous semicircular dependencies that Moya package brings to the table.
This breathes a new life into https://foldoc.org/field+circus
I had this issue after the current branch rename in the project and resolve it by clearing xcuserdata in workspace.
Nothing worked for me except Product -> Clean Build Folder and Restart
For me, Xcode was opened using Rosetta which wans't enabled before. Disabling Rosetta helped me 💪🏼
In Xcode 12.0.1 (12A7300) this bug has been fixed. It was auto-resolved by the Xcode update for me.
EDIT Xcode 12.5 [beta]
Apple added a SPM cache. See my question here. If you run into this problem with this Xcode version it might help to delete this cache.

Can't use cocoa pod modules once installed into Xcode project

I have install this cocoapod successfully and I am now running the workspace project instead of the Xcode project so I can successfully see the pod in the navigator.
I am now trying to import the module into my class by typing:
import OpenSphericalCamera
but I just get this error
No such module 'OpenSphericalCamera'
Are there further steps I need to do before being able to import modules into my class?
Please dont name your Project copied of the framework you installed. Or try Cmd + Shift + K (Clean build), or just Build it first (Cmd + B)
Try close xcode and reopen. Maybe the error gone ^_^

Xcode 9.2 Building failed without showing any errors

Update
I know the problem isn't within the pods the problem only happens when I start refactoring the project changing existing classes or so then when I try to build the project it simply fails with no error unless I'm in the file itself which has the error.
Problem
I'm trying to refactoring existing project on a separated branch but as it showed in the attached link the Xcode not showing any errors but it keeps failing
Note:
what I've tried to:
Clean and Build
Clean and Quit -> Xcode
Change build setting to show all compiled items
Video showing the issue
Preview for the issue
If you're using pods for your project, then quit xcode update your pods with pod update a

XCode 8 , Swift 2.3 returns error Could not build module

After I updated to XCode 8 and we are trying to move to Swift 2.3 and I try to compile and build my project but there are few errors. I managed to get every other library working, only PubNub is unable to compile.
I Googled and try different solutions, nothing is working. I can build project from GitHub's test project
https://github.com/pubnub/SwiftExample
Errors are:
pleasurreApp/AppDelegate/AppDelegate.swift:14:8: Could not build Objective-C module 'PubNub'
Pods/PubNub/PubNub/Core/PubNub+CorePrivate.h:1:9: 'PubNub+Core.h' file not found
Please run pod update from your project's root directory (or where Podfile is stored). Current PubNub SDK version is 4.5.3.
Quit Xcode and delete DerivedData folder. After relaunch build should complete well.
Best regards,
Sergey

Resources