No such module ... in Xcode - ios

I've run into a problem with Xcode (using Swift) that has me completely stumped. I realize that this question has been asked and answered, but none of the answers have worked for me, and my situation seems to be a bit different than the others, as all of my pods are failing (not just a specific one). They all worked fine a week ago.
I use Cocoapods for some of the more common Swift frameworks (e.g. Alamofire, Eureka, Kingfisher, SwiftyJSON, etc.). They were all working fine in Xcode 7. However, one of the (automatic) updates bumped up my Xcode version, after which it became mandatory to specify your target in the podfile. I did this and ran pod install. The pods are all still there, but now every import statement that relates to these frameworks fails.
At first I thought it was an Alamofire issue, as that's the first one that failed with the "No such module 'Alamofire'" error. I tried everything I could with Alamofire, including the following:
Clean and rebuild
Clean build folder
Restart Xcode
Re-boot computer
Delete all derived data
Added framework to "Linked Frameworks and Libraries"
Added framework to "Link Binary with Libraries"
Verified that I am opening the workspace rather than the project
Re-installed CocoaPods
Re-installed Xcode ver 7.3.1
Nothing would remove the "No such module ..." error. Finally, I removed Alamofire from the pods and just dragged the Alamofire project into my project. This allowed me to remove the import statements for Alamofire. However, to my dismay, now the next framework caused "No such module". I moved the next three frameworks into my project, and it looks like it is just going to keep going. Apparently, none of my Pods frameworks are being recognized anymore. I installed Xcode 8 and tried that with Swift 2.3, but I get the same "No such module" errors.
I really would prefer to use Cocoapods, as it makes upgrades a lot easier, along with other bonuses. I'm guessing I have some setting wrong that is screwing up all my pods, but have not had any luck finding it. This is a bit of a disaster as it has shut down development for several days, with no sign of a fix. If there is anything I can do or provide to assist in finding a solution, just let me know. If anyone could provide any possible solutions or even things to try, it would be greatly appreciated. I'm currently working with Xcode version 7.3.1.
My pod file looks something like this:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
target 'Y2GOsp' do
use_frameworks!
# Pods for Y2GOsp
pod 'Alamofire', '~> 3.0'
pod 'AlecrimCoreData', '~> 4.0'
pod 'Kingfisher', '~> 2.4'
pod 'Eureka', '~> 1.6'
pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git', :branch => 'xcode7'
pod 'PhoneNumberKit', '~> 0.1'
pod 'PKHUD'
pod 'Dollar'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '2.2'
end
end
end

Comments from #l'L'l led me to the solution. I went to
build settings > frameworks search path
and set it to the following:
$(inherited) (non-recursive)
$(PROJECT_DIR)/build/Debug-iphoneos (non-recursive)
$(SRCROOT) (recursive)
It is now correctly finding the pod frameworks.

Make sure you opened the .xcworkspace file in Xcode and not just the .xcodeproj file.

In Pod file
Uncomment below lines to define a global platform for your project
platform :ios, '10.0'
use_frameworks!
Now in xcode
a) Clean your project
b) Make sure that all your "Pods" > "Build Settings" > "Build Active Architecture Only" is set to "NO"
c) Now, build project

Sometimes pod deintegrate and then pod install helps me as well

try to make the version of your SDK into earlier versions
pod 'Alamofire', '~> 3.0'
pod 'AlecrimCoreData', '~> 4.0'
pod 'Kingfisher', '~> 2.4'
pod 'Eureka', '~> 1.6'
pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git', :branch => 'xcode7'
pod 'PhoneNumberKit', '~> 0.1'
pod 'PKHUD'
pod 'Dollar'
for example change 3.0 to available previous version, it worked once for me when i was facing the same issue.
pod 'Alamofire', '~> 2.4' #I am assuming prev available version is 2.4
But it doesn't have to be the "Alamofire" version result in "No such Module", you may try every one in your list in the pod file.

I had the same problem and I just solved it by making sure that my "Find Implicit Dependencies" is checked. Go to Edit Scheme -> Build. Previously I uncheck this so my xCode will run a little bit faster. Never realized that it will later throw me this error.

Although the question is long time ago, "no such module" error made me in Xcode 13 struggle for 3 days. I found many different solutions here, but still cannot fix it. Until I tried applying different solutions together and found my own solution.
My issue is that I can build the app on device, but shows "no such module" when building it on simulator. It seems there is something wrong while building pods.
Therefore, I added use_frameworks! & use_modular_headers! in Podfile.
target 'Application' do
use_frameworks!
use_modular_headers!
pod 'ChameleonFramework/Swift', :git => 'https://github.com/wowansm/Chameleon', :branch => 'swift5'
pod "BSImagePicker", "~> 3.1"
pod 'FirebaseCoreInternal'
I also changed the Build Setting of the Pods to exclude building pods in architecture of arm64. I did the same in my Project and Target's Build Settings.
Image of Pods' Build Settings
Please note that if you install new pod to the project, the Build Settings of Pods will be reset. You need to mannaully change back to exclude arm64.

For me the problem was that I updated the name of a build configuration within my project, but I didn't select the new build configuration in the scheme that used that build configuration. Updating the build configuration within the scheme to the new name fixed the issue!

You should excluded Architecture to nothing, also I did run the pod install command to install the pods.

Related

1188 duplicate symbols for architecture arm64

this question has been asked a ton of times already but I'm still not able to understand how to really solve this...
I'm a beginner guy in iOS i never did iOS before and I do not understand how this things works, like armv64, armv7, armv64e, armv7s... There are a ton of configurations in the project file I don't understand and I don't even know if they are right or wrong...
My situation at the moment is I'm trying to publish an app to app store but I received an e-mail saying this
ITMS-90809: Deprecated API Usage - Apple will no longer accept submissions of new apps that use UIWebView as of April 30, 2020 and app updates that use UIWebView as of December 2020. Instead, use WKWebView for improved security and reliability. Learn more
Well to my understanding I need to stop using in my app UIWebView and start using WKWebView.
It's ok I did change my code to support WKWebView, but the problem is I still get the error because i have an external library referenced in my Pods.
The library is named AFNetworking and through some research on this post they recommend to change on my Podfile from:
pod 'AFNetworking', '~> 3.0'
to
pod 'AFNetworking', '~> 4.0'
Very well I did change it but it also forced me to changed my deployment target from:
platform :ios, '8.0'
to
platform :ios, '9.0'
Because of this error, "Specs satisfying the AFNetworking (~> 4.0) dependency were found, but they required a higher minimum deployment target."
After I did that i launched the file .xcworkspace and when I try to build I always get these errors of duplicate symbols, lipo, mach-o linker, etc... And honestly this is really confusing to me.
I did try the clean / build method, deintegrate and install pods again, but doesn't solve it, can you please help me ?
EDIT
My Podfile pods:
pod 'MagicalRecord', '~> 2.2'
pod 'MLPAutoCompleteTextField', '~> 1.5'
pod 'MBProgressHUD', '~> 1.1.0'
pod 'ECSlidingViewController', '~> 1.3'
pod 'Fabric', '~> 1.7'
pod 'Crashlytics', '~> 3.9'
pod 'AFNetworking', '~> 4.0'
pod 'Firebase/Messaging'
Image of errors:
Thanks for everyone that helped me trying to get this fixed.
I was able to fix it by doing these steps:
I removed some librarys I had referenced in my target, by going to project view -> target -> general and then here I removed some duplicated librarys I had.
After that I closed XCode and then went to my project folder in finder and deleted, pods folder, podfile.lock, .xcworkspace file.
I also added a line in my podfile use_frameworks!
Open terminal, go into project folder, and did the following commands:
pod deintegrate
pod install
After that opened the newly created .xcworkspace file, clean project and then build.
I think the problem I had is that I had these frameworks in my project targets and they were the same as in the pods so that's why I had the issue of duplicate symbols.

using bridging headers with module interfaces is unsupported Command CompileSwiftSources failed with a nonzero exit code

I have razor pay pod in my project for payment gateway and SWRevelViewController file for side bar controller. I selected the swift 5 and iOS version 13 and updated all the pods but still getting error
error: using bridging headers with module interfaces is unsupported Command CompileSwiftSources failed with a nonzero exit code
pod 'Alamofire', '~> 4.5' pod 'TWMessageBarManager'
pod 'SwiftValidator', :git => 'https://github.com/jpotts18/SwiftValidator.git', :tag => '4.2.0'
pod 'SDWebImage', '~> 5.0'
pod 'DropDown'
pod 'MBRadioCheckboxButton'
pod 'SwiftyJSON', '~> 4.0'
pod 'razorpay-pod', '~> 1.1.1'
pod 'GoogleMaps'
pod 'GooglePlaces'
pod 'Firebase/Auth'
pod 'SVProgressHUD'
pod 'FacebookLogin'
pod 'FacebookCore'
pod 'ImageSlideshow', '~> 1.8.0'
pod "ImageSlideshow/SDWebImage"
pod 'Firebase/Core'
pod 'Firebase/Messaging'
pod 'PopupDialog', '~> 1.1'
pod 'GoogleSignIn'
pod 'AppAuth','~> 1.2.0'
I checked your problem and as per you selected project language project work properly in XCode 10.2 but you require changes for updated XCode 11.2.1
Please follow few things :
Make sure first your bridging header file path is proper in build settings.
You need to update razor pay pod because you add tag (pod 'razorpay-pod', '~> 1.1.1'), and pod updated in Swift 5.1 so please remove it and change pod name with pod 'razorpay-pod'
Please change your build settings. Set Build Library for Distribution in the build settings for the target framework to YES.
Hope it’s helpful to you.
In my case, i had to follow these steps:
Step 1:
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'NO'
in my Podfile under
...
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
# Put it here (indent like this)
...
Step 2
Select Runner on the left Panel
Under Targets, select the target (usually "Runner")
Select Build Settings from the top Menu
Scroll down to Build Options and find the option "Build Libraries for Distribution"
Set the value of "Build Libraries for Distribution" to NO (or set it for any particular build scheme)
Clean Build Folder
Delete flutter "build" folder, run flutter clean & flutter pub get
This is a similar question (same exact error message) to Xcode 11.2.1 error: Command CompileSwiftSources failed with a nonzero exit code.
I posted an answer that can be found here.
Hope it works for you!
So I faced a problem with Razorpay swift version and following one of the suggested methodologies set Target>Build Libraries for Distribution to Yes.
Big mistake.
kept getting
error: using bridging headers with module interfaces is unsupported
Finally fixed it by setting Build Libraries for Distribution Back to No
[Razorpay issue was still not resolved so had to downgrade Flutter]
I have solved it in this way, Detailed steps are here, Solution to Xcode Error: using bridging headers with module interfaces is unsupported
Solution:
In your Project Level & Target level Build Settings tab, open the Build Options menu. And then set Build Libraries for Distribution option to No.

Dependencies from subproject cause dyld: Library not loaded error

Specs:
Xcode 8.2,
CocoaPods 1.1.1,
OSX 10.12.2
I split my project in 2 projects. One contains my providers (does api calls, database access, etc), the other the UI.
The UI project depends on the providers project. My configuration is working with the simulator but not with the device.
On device, I get:
dyld: Library not loaded: #rpath/Alamofire.framework/Alamofire
Referenced from:
/private/var/containers/Bundle/Application/EAD65532-DD02-4DA6-9877-7937F9D69F26/xxxxx.app/Frameworks/Providers.framework/Providers
Reason: image not found
This is my podfile:
use_frameworks!
workspace 'xxxxx.xcworkspace'
project 'xxxxx.xcodeproj'
project 'Providers/Providers.xcodeproj'
def shared
pod 'QorumLogs'
pod 'Reachability', '~> 3.2'
pod 'RealmSwift'
end
target 'Providers' do
project 'Providers/Providers.xcodeproj'
pod 'Alamofire', '~> 4.0'
pod 'Valet'
pod 'Starscream'
pod 'ChameleonFramework/Swift', :git => 'https://github.com/ViccAlexander/Chameleon.git'
shared
end
target 'xxxxx' do
project 'xxxxx.xcodeproj'
platform :ios, '8.0'
pod 'SwiftValidator', :git => 'https://github.com/i-schuetz/SwiftValidator.git', :branch => 'remove_delegate_callback'
pod 'SwiftCharts', :git => 'https://github.com/i-schuetz/SwiftCharts.git'
pod 'Google/SignIn'
pod 'SwipeView', '~> 1.3.2'
pod 'CMPopTipView', '~> 2.0'
pod 'KLCPopup', '~> 1.0'
pod 'ChameleonFramework/Swift', :git => 'https://github.com/ViccAlexander/Chameleon.git'
pod 'HockeySDK'
shared
end
I also added the binary of Providers to my UI target under "Embedded binaries"
It seems the UI project can't load the dependencies of Providers project. Don't know if this makes sense, but I also tried nesting the configuration of my UI project in Providers, in the podfile, and add inherit! :search_paths to it but it also didn't help.
It works only when I use the same dependencies in both projects.
Ideas?
Edit
I also get this warning when executing pod install, don't know if it's related:
[!] The Podfile contains framework targets, for which the Podfile does
not contain host targets (targets which embed the framework). If this
project is for doing framework development, you can ignore this
message. Otherwise, add a target to the Podfile that embeds these
frameworks to make this message go away (e.g. a test target).
While updating a Swift 2.2 project using the AlamoFire third party framework I ran into several issues just like yours including the dreaded dyld: Library not loaded ...... image not found.
After spending several hours reading about different explanations for the problem,trying to figure it out myself, and implementing many of the suggested fixes, I reached an impasse. Some of the solutions worked on simulator and not iPhone which gave me (false) encouragement to keep trying to fix the problem.
I eventually reached the conclusion that starting with a clean slate may be a better strategy. I had already shown that a new Swift 3 project could use AlamoFire 4.0 and other third party frameworks such as ReactiveSwift (via cocoapds) without a problem. I think this may be a general strategy that avoids the difficulty of tracking down build, build phase, or file location problems.
So here it is. It's very simple. Create a NEW project. Install the AlamoFire and all the other frameworks using cocoapods and test it to make sure it works. At this point delete files you will be replacing such as ViewController.swift and the Main.Storyboard, then drag over all the files from your old project. I converted to swift 3 before I did this to make things even easier. I rebuilt the project and it worked first time! Even the storyboard links were preserved like magic. 1h of work (if that) instead of several! I hope this works for you too!

ld: framework not found error in xcode 8

I am using xcode 8 for development and cocoapods 1.0.1 for frameworks. After installing frameworks, i couldn't able to build my project. I am getting "ld: framework not found" error. I am using following lines in pod file:
# Uncomment this line to define a global platform for your project
platform :ios, '9.0'
target 'Sample' do
use_frameworks!
pod 'MBProgressHUD', '~> 0.9'
pod 'TPKeyboardAvoiding', '~> 1.2'
pod 'SDWebImage', '~> 3.7'
pod 'UIActivityIndicator-for-SDWebImage'
pod 'UITextView+Placeholder', '~> 1.2'
pod 'Alamofire', '~> 4.0'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.0'
end
end
end
After installing the frameworks, did you closed your project and opened the newly created workspace?
Once you start using CocoaPods to install framework, you must use the workspace as it includes your Sample project and the Pod project containing the frameworks.
In you project directory, make sure to open the .xcworkspace instead of .xcodeproj.
Edit:
If that is not the issue, go to your Sample target/General/Linked Framework and Librairies
You should only have one that should be name something like: Pods_Sample.framework
If you are only using cocoa pods to install frameworks it should be the only one there as it includes all the pods.
select your target -> General ->Embedded Binary , click + ,and add Alamofire.framework
try adding project 'APP_NAME.xcodeproj' to your podfile after use_frameworks! and do pod install again
if you receive warnings like below, after pod install
[!] The `APP_NAME [Debug]` target overrides the `FRAMEWORK_SEARCH_PATHS` build setting defined in `Pods/Target Support Files/Pods-BasePods-APP_NAME/Pods-BasePods-APP_NAME.debug.xcconfig'. This can lead to problems with the CocoaPods installation
Go to Build Settings of your target and add $(inherited) to Framework Search Paths
I had this problem, and it happened a while after renaming my project.
It was using my Pod_Old_Project_Name as a framework.
I fixed this by going to Build Phases -> Link Binary With Libraries, and removed that framework.
There are two reasons this error occurs
I have faced the same issue, This comes only due to change in the
pod file or maybe the pod file may not exist, double check the pod
file and run the cmd pod install
After successfully installing the pod file still if you getting this
error please restart the Xcode, error goes away

Cocoapods missing pod include files when removing all test pods

I have an iOS project I've been working on for some time, successfully, in which I used several pods for my main target, and then a couple more for my test target. Everything went swimmingly.
I was using a pod for tests, Expecta, because I needed to test asynchronous code. Now that Apple has added support for asynchronous testing in the latest Xcode, I rewrote my tests to use that, and want to remove Expecta from my project.
After doing that, my tests no longer compile, with errors about the header files from the pods no longer being found. For instance, `'FacebookSDK/FacebookSDK.h' file not found' error compiling one of my tests.
I've tried deleting all the Cocoapod-generated stuff and redoing it from pod install with no luck.
Versions: Cocoapods 0.35.0, Xcode 6.1.1, OS X 10.10.1.
My new, no-test-pods Podfile is:
# Uncomment this line to define a global platform for your project
platform :ios, '7.0'
target 'Meow' do
pod 'AFNetworking', '2.4.1'
pod 'TestFlightSDK', '3.0.2'
pod 'AWSiOSSDKv2/S3', '2.0.11'
pod 'Facebook-iOS-SDK', '3.20.0'
pod 'TTTAttributedLabel', '1.10.1'
pod 'DTCoreText', '1.6.14'
pod 'ReactiveCocoa', '2.3.1'
end
target 'MeowTests' do
end
Removing the MeowTests target hasn't helped either.
While I was typing the above :) I found this question; which says to add a link_with line to my podfile, and change the configuration file setup in the Info pane of my Project.
However, because I was removing the last pod from my test target, I also needed to delete the CocoaPods-specific phases from my test target. In the Build Phases tab, I removed Check Pods Manifest.lock and Copy Pods Resources.
Now my tests run fine. (And I can start rewriting them in Swift :) )

Resources