question about module import error of cocoapods - ios

I am new to Swift and Xcode, I once import Alamofire, SwiftyJSON using cocoa pods in some tutorials, In the beginning, everything works fine, but recently every time I restart my swift project, I always get an error of No such module 'Alamofire', and the pods_proejctname.framework in Frameworks is lost but I didn't do anything:
However, the files in Pods in Xcode repositories doesn't show complete files and folder as finder shows:
If I opened the pods XCode project, the files in the products folder is missing, but I didn't do anything:
When I tried to fix it, this error somehow disappears. Can someone help me with this problem? please comment on my post if you need me to show further information about my project. Thank you!

you have lost path to your libraries in your project. Instead of configuring your path manually just remove your project from cocoa-pods and configure it again. Run the following commands on your project from the terminal
step 1
pod deintegrate
step 2:
delete Podfile.lock and yourproject.xcworkspace file manually from your project. also if delete the pods folder from your project if exist.
Step 3:
install pods again by running
pod install

Related

xcode ios 'No such module GoogleSignIn'

I have an ios project that works good but after i push it to git hub and clone it again from other computer i get this error
'No such module GoogleSignIn'
No such module GoogleSignIn
Open your project in terminal app and do pod install
Another possible solution: open xcodeproj file instead of xcworkspace and check again
Try Following things:
Clean the Xcode project using Command + Shift + K
Install the dependencies again using pod install (if using Cocoapods)
Restart Xcode.
Open the .xcworkspace file rather than the original project file itself.
Delete .xcworkspace file and pods folder from directory and then install the pod dependencies using pod install
I had the same problem and the way I fix this is that every time I get this error, I just close the project and reopen it. While this happens, I think it saves on to my icloud.
For me, It was a Xcode bug on duplicate files.
Step 1: Copy the contents of the file in which there is the error of "No such module ****"
Step 2: Delete the File
Step 3: New a file and Paste the contents.
I got same problem
My mistake is that I put below pod
pod 'GoogleSignIn'
in wrong line in podfile
The right one should be below :
#Pods for ,YOUR APP NAME here,
Then I did install the pods again using the terminal and no more got the error
I hope you to get the solution

RealmSwift: No such module 'RealmSwift'

I configured RealmSwift 1.0.0 Latest Using Docs into the Xcode project. After installation i created a class file and getting module error - like: No such module 'RealmSwift' in class file.
1.
2.
3.
4.
After adding the Realm Plugin, i created a class and get the module error below.
Please help me to solve this error.
A very important sanity check: if you run into this and you're using Cocoapods, please make sure you open the .xcworkspace and not the .xcodeproj file!
Follow below steps, it may be useful for you.
Go To: Product > Schemes > New Scheme...
Select: RealmSwift and click OK
Build the RealmSwift target (cmd + b)
It looks like you've added the path to RealmSwift.framework to your framework search paths. The Realm Swift installation instructions say to add the parent path of RealmSwift.framework (i.e., the containing directory) to your framework search paths.
I had the same problem like you.
I resolved it by add the following code into pod file.
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
Follow below instructions:
Clean from Xcode (Shift+Cmd+K)
Delete the Derived Data directory (~/Library/Developer/Xcode/DerivedData)
Build the project (Cmd+B)
After "pod install" or "pod update" fix it
else
try this:
sudo gem install cocoapods-deintegrate cocoapods-clean
pod deintegrate
pod cache clean --all
rm Podfile
pod "deinitialize" to fix that issues.
I've struggled with this problem as well for 2 hours; I tried several things, like cleaning, uninstalling and reinstalling the Realm pod, changing the Podfile, and so on.
Nothing worked until I restarted the computer.
I use Xcode 8.3.3 and Xcode 9.2 Beta, Swift 3, High Sierra MacOS.
After "pod install" restart Xcode
You can add Run script file for your project.
"${SRCROOT}/Pods/Target Support Files/Pods-Realm Database/Pods-Realm Database-frameworks.sh"
For me there first was an error like 'could not build Objective-C module 'RealmSwift'' which I could fix by deleting the Derived Data Folder, Pods Folder, Podfile.lock and the .xcworkspace and after that there was the error saying 'No such module 'RealmSwift'' which only disappeared when I first tried to build the project. Now everything works fine for me!
In my case i tried other suggested solutions and it didn't work for me but this replacement fixed problem and the error have gone
Try use
pod 'RealmSwift'
instead
pod 'Realm', '~> 10.1'
Let me tell you how I get that error and how I solved it.
I am using Carthage in my project, but I am new team member, so I did git clone the project. But I opened the project before run cathage upload command. Although I ran the cathage command, I got that error.
I could fix it doing the next:
Go to the project file.
In build phaces -> run script -> Input file.
Add $(SRCROOT)/Carthage/Build/iOS/Realm.framework and
$(SRCROOT)/Carthage/Build/iOS/RealmSwift.framework
I do not know why it is not always automatically linked.
In my case, setting project format to current Xcode version in pod target helped:

CocoaPod : Unable to remove the Pod from project

I have a xcode (iOS) project in which i am cocoapods.
I have couple of pods installed:
SwiftHTTP & SwiftyJSON.
Now for some reason I decided to try another pod namely EZAlertController. Nothing wrong with the pod. But i decided not to use it. So I need to uninstall this pod from my project.
So far whatI have done:
remove pod 'EZAlertController', '0.3'from the podfile
run pod install which gave me the message of
Removing EZAlertController
No EZAlertController folder in the Pods folder either. So far so good.
Now i closed the xcode and reran the .xcworkspace file.
clean & build routine - all good - Again
P.S.(also tried pod update)
The Problem:
I am still able to import EZAlertController into the project and run. What is really annoying is that I forgot to take a git snapshot. So can't just revert back without loosing considerable amount of code.
Any idea on how to completely get rid of EZAlertController even after removing as there is still some linking with xcode :(
Try to clean the project: Product -> Clean and also Product -> (hold option key) Clean Build Folder
Maybe deleting the derived data could resolve your issue
I wouldn't remove the pod. I've had this problem before. I tried blowing away all the pods but continued to experience the problem. What I would do is blow away all the pods, reinstall Cocoapods to the project, then try installing it again.
Alternatively you can add the framework you need manually.

Cocoapods error for one project target while others are working fine

I have create 3 project target (Development, Production and Staging).Expect Production other working fine after pull the changes of others while building the production target xcode giving the error :
gone through some of the available solution but no success!!!
If you change something the conflict will be occur, do like remove your WorkSpace once and again install or update your Pods,it will Work
Run pod install or pod update your CocoaPods installation.
For additional Information see this1
Choice-2
there's a problem with Cocoapods in your project. Sometimes cocoapods can get out of sync and you need to re-initiate cocoapods. You should be able to resolve this error by:
Deleting the Podfile.lock file in your project folder
Deleting the Pods folder in your project folder
Execute pod install in your project folder
Do a Clean in Xcode
Rebuild your project
Conclusion: don't run pod install while project opened in the Xcode.
Update answer
I. Project Cleanup
In the project navigator, select your project
Select your target
Remove all libPods*.a in Linked Frameworks and Libraries
II. Update CocoaPods
Launch Terminal and go to your project directory.
Update CocoaPods using the command pod install
I have solved my problem by this way :
After implementing lot many solution i got this error :
By removing Check pods manifest.lock, Copy pods resources and Embed pods frameworks from Build Phases of Tests project target(xxxTests) i solved the issue.
NOTE: If any one still getting any issue related to pods, then try to remove libpods-xxx.a from Link Binary with libraries and again add it.

Pod CoreData+MagicalRecord.h file not found

I recently had to delete a xcode project from my computer and re-clone it down. After cloning it, I ran a pod install and then went to build the project. However, I kept hitting a error in my .pch file that claimed a file (a pod file) was not found.
I looked into the following SO posts:
iOS - Build fails with CocoaPods cannot find header files
Unit Test build failing when importing MagicalRecord
From there I gathered that I needed to add to Header Search Paths the $(inherited) flag. I've done that, I've cleaned the project, and then re-built it, and still am having the following error..
As of version 2.3.0 (released on 1 June 2015) the file CoreData+MagicalRecord.h seems to have been renamed to MagicalRecord.h only.
If you installed MagicalRecord using CocoaPods and ran pod install or pod update again you might have gotten this new version and will end up with the same error message: CoreData+MagicalRecord.h file not found
So you should change the import of the header in your pch file then. This is what I have now:
Try to add this line on top of your podfile:
link_with ['ProjectName', 'ProjectNameTests']
before this line
platform :ios, '8.0'
Install pod, and at your project Build Setting->Other Linker Flags, add $(inherited).
import "MagicalRecord/MagicalRecord.h"
Try to run command (1) in terminal, then add import in step (2)
In your project directory,run pod update
You should now be able to add
#import <MagicalRecord/CoreData+MagicalRecord.h>
to any of your target's source files and begin using MagicalRecord!
I think with 2 steps you can be solved this problem.

Resources