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:
Related
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
I'm trying to add a framework to my IOS project but when I build I always got the same message :
ld: framework not found Pods
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I tried to remove my Pods directory and then run pod install
I open the .xcworkspace like it is written in the logs on the pod install, I clean the project on xcode and then try to build but it won't works..
My podfile looks like this :
xcodeproj '/Users/guillaume/project/Mobile/iOS/FoodPin/FoodPin.xcodeproj'
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'SwiftHTTP', '~> 0.9.2'
My version of xcode is 6.3.1
Thank you,
In Project Navigator in the folder Pods I had a Pods.framework in there which was red. It was also present in Linked Frameworks and Libraries. I removed both references and the error disappeared.
TL;DR
Remove Pods.framework in:
Folder named Pods
Linked Frameworks and Libraries
This is usually caused by having the .xcodeproj file open instead of .xcworkspace.
When you run 'pod install' for the first time, it will create an .xcworkspace file, which includes your original .xcodeproj and a Pods project. You'll need to close your .xcodeproj and open the .xcworkspace instead.
This is a common issue when creating a project through Xcode's new project wizard - I often forget that I'm not in a workspace, which is required to get Cocoapods to link correctly.
Xcode 9, 10, 11, 11.5
install https://github.com/CocoaPods/cocoapods-deintegrate
pod deintegrate
then
pod install
I cleared this error by deleting the red .framework files that were located in a folder Frameworks in the project navigator. I think this also automatically deleted corresponding red entries in the Linked Frameworks and Libraries section of the General settings.
I have been cleaning / reinstalling pods in order to fix another issue. Perhaps these red framework files and entries were just leftover from a previous pod install?
I had a similar issue as
framework not found Pods_OneSignalNotificationServiceExtension
It was resolved by removing the following. Go to target OneSignalNotificationServiceExtension > Build Phases > Link Binary with Libraries and deleting Pods_OneSignalNotificationServiceExtension.framework
Hope this helps. Cheers.
For who find this issue. I am using NativeScript and got the same error.
That happen becouse I opened the file .xcodeproj, but we must open the project by the file .xcworkspace.
This happened to me after updating my Podfile and doing a pod update.
For some reason, I had a "Pods_[ProjectName]".framework file appear under my project under 'Targets' > General > Linked Frameworks and Libraries.
Deleting this and then clean/rebuilding fixed the issue.
you should delete your project some file as this picture.
I was getting this error because i renamed my project and change the name of project in pod file too but my project was referring to old name which was not there and causing this error . I get rid of this by
pod deintegrate
followed by
pod install
Just Remove your .framework from the list of "Your Project->General->Linked Framework & Libraries".
It's happened to me because I changed the Deployment Target in General but forgot to change the Deployment Target in Pods > General.
[Xcode 11.2.1]
For me it was different app target version in Podfile(platform :ios, '11.0') and in Xcode project file .
It causing Archiving job fail in CI pipeline.
Matching both value fixed an issue! Hope this help anyone.
This issue was driving me crazy as it suddenly happened without doing any changes to the project. I've tried all suggested solutions in this thread (and other related) and none of them solved the problem.
The only thing that differed from my other projects (which compiled fine), was that this project name was containing an accent (a french accent, "é"). I've renamed the project and all related files, and it finally worked !
Maybe this is related to updating to Xcode 10, because this project was working well before...
EDIT : it also seems to failed when using a project with - in project name…
In my case I can build it on devices and simulator but has the same errors when archiving. To solve it, I have to
remove Pods.framework
make sure Pods-<project-name>.framework is embedded
You will find the settings in TARGETS-->Linked Frameworks and Libraries.
In my case, after comparing the difference between a branch I knew built correctly, I noticed this line in my Podfile:
platform :ios, '11.0'
I had inadvertently up'd my target version from 10 to 11 while my targets in Xcode remained set to 10. Reverting back to 10 solved my issue for me.
Ensure your target iOS versions are properly set.
Step 1
The first thing that you will need to do is remove the Podfile, Podfile.lock, the Pods folder, and the generated workspace.
Step 2
Next, in the .xcodeproj, remove the references to the Pods.xcconfig files and the libPods.a file.
Step 3
Within the Build Phases project tab, delete the Check Pods Manifest.lock section (open),Copy Pods Resources section (bottom) and Embed Pod Resources(bottom).
Step4
Remove Pods.framework.
The only thing you may want to do is include some of the libraries that you were using before. You can do this by simply draging whatever folders where in the pods folders into your project (I prefer to put them into my Supporting Files folder).
It worked for me.
Using Xcode 8.3 the accepted answer didn't work for me. I had tried many other solutions but #Elliott Davies answer is what fixed it for me. I'm adding a screenshot for clarity. For some reason, Xcode was trying to link previous podfile setups that no longer existed. All I had to do was delete the extra references and everything worked.
You're more than likely trying to get the pods to work into you project right?
The only way to do so is by creating a separate project that uses CocoaPods.
Close all work-spaces that you are using.
Next, make sure you have your Podfile completely ready to go.
In the command line, wherever your file is, type the command:
pod deintegrate
Then, install your pod agian.
pod install or pod update
Now you can use your project's new workspace to develop from. Look for a file called .workspace. Use that file!
Here is a guide on using CocoaPods
This is the way i fix my problem. and it now work when i writing this answer:
Firstly, i try all the most fix way above,
remove Pods_xxx.framework from the link libraries and framework in target's build phases is helpful, and the issue will disappear, but the coming problem is i can't import the Pods.framework anymore.
And Then, i try to reinit the xcworkspace config, so that i can figure out the real problem. so i run
pod deintergate
and then install my pod again:
pod install
this work prefectly, but the problem is still in there, but i figure out the real problem is the Pods_xxx.framworks not be compiled succeed by cocoapods build script. I think this is the true way to fix the problem.
Finally, i try to edit my project's scheme:
and i add Pods scheme into manage:
and build this Pods.framework separately, and you will find the Pods.framework icon become truly again:
and i think now you have fix your "framework not found Pods_xxxx.framework" problem
but actually i have another problem coming:
so i go to the build setting, and edit the "Framework Search Path" with "${inherited}",
and now all the problems goes out, cheer!!!!:)
After removing and updating pod I still had same issue.
I've found that previous developer put flag in 'Build Settings -> Other Linker Flags' with Framework name (in my case -framework 'OGVKit') that made the issue.
After deleting that flag, project builds properly.
Other thing that solved my problem is to go under Target -> Build Settings -> Other linker Flags and delete the "-framework" and your framework "name".
It happened when i tried to remove a pod.
in my case, my problem was the following: ld: framework not found UserMessagingPlatform.xcframework
for me, the solution was the following:
open a finder window and go to the ios folder
look for the following files:
Pods-[YOUR PROJECT NAME].release.xcconfig
Pods-[YOUR PROJECT NAME].debug.xcconfig
open those files and remove the following text: -framework "UserMessagingPlatform.xcframework" in both files
I did experience this problem because I did not set the platform correctly.
So in my macOS app I had the platform set to:
platform :ios
instead of
platform :osx
In my case, there was a reference to the library I removed on
Targets > Build Settings > Runpath Search Paths
Removing the library from Podfile and updating it obviously didn't remove it, so I had to do it manually and now everything works.
None of the previous answers pointed out the root problem in my situation.
So I hope this may be useful to someone else.
In my case I ended up having to edit my podfile at the root of my project. When I first created my podfile, swift static libraries were not supported.
So I had been using use_frameworks! in my podfile under each of my targets as such:
BEFORE
...
target 'targetName' do
use_frameworks!
pod 'podName', '~> 0.2'
end
AFTER
...
target 'targetName' do
pod 'podName', '~> 0.2'
end
I removed use_frameworks! from my podfile which kept installing the frameworks every time I ran pod install. After removing this line, make sure to run pod install again and remove any of the red .framework references from your Frameworks folder in Xcode. (Though mine appeared differently as attached below.)
Image of Removing .framework files that are no longer necessary
You can also read more about use_framework! here.
I had the same issue after removing some pods from my project.
First I have used pod deintegrate after that pod install in the terminal but didn't work for me.
So I went to the second step inside my project Build Setting and on the Other Linker Flags option, I have found that the deleted frameworks are not removed so I removed them manually.
I have resolved this issue.
delete these three files.
Podfile.lock
Pods folder
.xcworkspace
Then open your project in terminal and run pod deintegrate command, and after then run pod install command
I resolved this issue by selecting the project which downloaded from CocoaPods and built it, you can click Manage Schemes so that it can be appeared in Run bar. Then you can rebuild your project. Hope it help.
I tried every answer on here and none of them worked. I ended up getting it working by upping the deployment target from 10.0 to 11.0. I have no idea why that fixed it, but I suspect it has to do with upgrading to Xcode 10.2.1.
maybe you suddenly open the wrong file of .xcodprj and you should open .xcworkspace
Using Xcode 7
I am trying to install Alamofire in a sample project. Have used the instructions from Ray Wenderlich's page
Only change from above link is the podfile -- which is from GitHub page here because the version has been updated. I have also used the Swift 2.0 branch.
Below is the snapshop of the error, my pod file and my terminal post installing the pod
PODFILE
TERMINAL
P.S: I want to use cocoapods to install Alamofire. I don't want to download it from github page
The Trick for me was to open the .xcworkspace file rather then the original project file itself.
working this:
Scheme -> Manage Schemes...
checked Alamofire checkbox → Build Alamofire scheme
and, if you used Playground , you should change settings Playground:
View -> Utilities -> Show File Inspector
Platform OSX → iOS
Try this one.
For Swift 2.0 there is no need to add Alamofire.xcodeproj into your xcode. Simply copy and paste source folder from https://github.com/Alamofire and you are done.
or if you want to install Alamofire from Cocoapods then try below code.
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'Alamofire', '~> 2.0'
import Alamofire after importing UIKit
Then comment it out, build the project first.
Uncomment it.
(this worked for me, and others, when the other answers did not).
For reference to anyone who comes across this problem in the future:
Swift 2.x + CocoaPods 1.x
Symptoms: build works in Xcode for debug configuration but fails when xcodebuild is executed from console using pod lib lint or similar command. The result is error: no such module 'X'
Solution:
In MyProject.podspec add your dependencies without specifying versions:
spec.dependency "Alamofire"
The Podfile should also contain the same dependencies. Then run:
$ pod install && open MyProject.xcworkspace
You should open .xcworkspace instead of .xcodeproj. The build will now work in both Xcode and console and pod lib lint passes validation.
I wrote this because I was trying to publish a new CocoaPods pod library and had a similar issue but found no answer and also because Google leads to this question.
Here is what to do:
close your project,
install your pod library,
then install alamofire.
After you do all things, don't open the file with extension .xcodeproj but open the file with extension .xcworkspace
My problem was solved using these steps :
Clean Project
Goto Project > Build Setting > Framework Search Path
and add
"$PODS_CONFIGURATION_BUILD_DIR/Alamofire" as non-recursive
$(inherited) as non-recursive
$(SRCROOT) as recursive
Adding Alamo Fire to all of my target's build phases fixed it for me.
There is only one way to solve this issue.
Quit Xcode.
Delete project's temp files located at
/Users/username/Library/Developer/Xcode/DerivedData
Delete ProjectName.xcworkspace
Delete Podfile.lock file and Pods folder Run pod install.
Open the newly created ProjectName.xcworkspace file and build.
credits to Dimitris Bouzikas here
Have been facing the same problem, following trick resolved the issue
Go to Manage scheme -> Select pod library that is causing issue -> Build
Change back the scheme to project and then run the app, you are good to go
Note: If you don't see the pod library in the scheme, go to Manage scheme and select the pod library that you would like to build.
After doing #satoshin answer, I also had to check the Shared box on the right hand side of the Manage Schemes window.
go to finder locate the project and navigate to the '.xcworkspace' file. thats where your pods are installed. if you go to your original project '.xcodeproj' you will only the pod debug files. hopes this helps. took me a while to figure out the problem too.
I am using swift 3, I fixed this problem by deleting Derived Data for this project.
Cheers...!!!
If clean project/restart xcode/reinstall cocoapods etc, did not work. You can try running Product -> Build for -> Testing (cmd + shift + u). The build failed but the import worked right after.
As for me worked to change the name of the project. Accidentally put
ProjectNameTests
instead of
ProjectName
No schemas needed if you've configured the names correctly everywhere:
Check Podfile
Check which project file you've launched.
(The white icon should be created for "xcworkspace")
Product -> Clean Build Folder
Product -> Build (Now you can run in a simulator).
Start from the scratch, because most of the errors always occur in a cause of humanity mistake, not developers.
If you've put the wrong name for project in Podfile check "Linked Frameworks...". If so - delete this framework. The path is showed below at screenshot.
Example of correct Podfile (Alamofire):
'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!
target 'ProjectName' do
pod 'Alamofire', '~> 4.7'
end
ProjectName should not contain any extensions(file types).
[For future seekers] you could have missed the second step from the below :
Go to Project Setting
Go to Build Phase tab, create a new run script phase and add an input file to your Alamofire framework. In my case I set $(SRCROOT)/Carthage/Build/IOS/Alamofire.framework
Go to General tab, scroll down to linked framework and libraries add Alamofire.Framework folder. You probably won't find it from list so you need to press "Add Other" button and introduce it yourself.
For absolute newbie just close xcode project and open by the new way.
Choose in your folder file which contains extension like this: .xcodeproj and just enjoy you life.
For me, solution was to exclude arm64 devices from Pods and Project.
Image is in attachment.
You can start by making sure you open the Xcode workspace file (with the extension .xcworkspace) instead of the project file (with the extension .xcodeproj). The workspace file contains dependencies installed by CocoaPods, and it is necessary to use it to work on your project.
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.
I'm doing the Ray Wenderlich tutorial called SimpleWeather.
The podfile is in the same folder as the project.
Here's my code from the podfile:
platform :ios, '7.0'
xcodeproj 'SimpleWeather'
pod 'Mantle'
pod 'LBBlurredImage'
pod 'TSMessages'
pod 'ReactiveCocoa'
The error message is this: [!] Unable to find the Xcode project /Users/myName/Developer/SimpleWeather.xcodeproj for the target Pods.
The name of the project is SimpleWeather.
I'm pretty sure you are not in the right directory. Are you sure your .xcodeproj is in the Developer folder? There might be a subfolder you need to navigate to.
The right way to enable CocoaPods in your Project is:
Open Terminal and execute: $ sudo gem install cocoapods
Navigate to your Project folder (I assume in your case it's cd /Users/myName/Developer/SimpleWeather/SimpleWeather.xcodeproj).
Setup Cocoapod pod setup
Create the Podfile touch Podfile
Open the Podfile open -e Podfile and insert your code for Podfile
Finally install the Podfile pod install
If you follow this instructions everything should work. When opening your project make sure to open the .xworkspacefile.
For more information, see this.
This error also occurs when you have multiple .xcodeproj in your Xcode project.
You don't need more than one .xcodeproj in general cases. Remove unnecessary .xcodeproj, and Cocoapods should get the correct path automatically afterwards.
Reiterating our original conversation:
Accordingly to Podfile Syntax Reference the Podfile looks right.
Make sure you are running $pod install from your project directory:
/Users/myName/Developer/SimpleWeather
Hey your path for the project might be wrong. Go to the project and right click on SimpleWeather.xcodeproj and select Get Info as show in the image below(The right side window is for Get Info here). Copy this path from the details window and paste it into the Podfile. After that append /SimpleWeather.xcodeproj to that pasted path. This might solve the problem(Note: It is a snap shot for my project). In your case the solution might be replacing the path with this /Users/myName/Developer/SimpleWeather/SimpleWeather.xcodeproj
To solve this issue, just follow below steps and your issue will get resolved :
Step 1 : Open Terminal and navigate to your project folder
Step 2 : touch podfile
Step 3 : open -e Podfile
Step 4 : Write below line in your text edit and close it
workspace '/Users/systemName/Developer/yourprojectname/yourprojectname.xcworkspace'
Step 5 : Pod install
And after successful process, you will not get this error again.
CheersKP
Maybe you have two project .xcodeproj, remove one.
Remove Podfile.lock, folder Pods. On Terminal cd /Users/myName/Developer/SimpleWeather and pod install
For people who are on Mac and also using code editors, the duplicate file that is causing this issue is ._projectname.xcodeproj because it has the same extension as the regular .xcodeproj files.
I had the same problem.
Then with many attempts of trials and errors I finally got the working solution:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!
target 'SimpleWeather'
pod 'Alamofire', '~> 3.4'
This works when you are in your project directory (I assume you should navigate using terminal to /Users/myName/Developer/SimpleWeather/)
You installed your Xcode..in application use this command to execute
sudo xcode-select -switch /Applications/Xcode.app
so okay i had tried every possible thing ...i had only one .xcodeproj file
but sill i couldnt install so finally i had tried with the following
1. open terminal cd to your project folder one with .xcodeproj
2. type pod init
3. type touch Podfile
4. type pod install
Magic happens and your pod files gets installed
Check your Podfile for the following lines
config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])
under
target '<project_name>' do
Hopefully this answer can be useful in times of many people using SPM. My case was the following: I had a binary framework package that had to be converted to the cocoapod, together with it's dependency tree. In the git repository where the package lived, the .gitignore file contained this line: /*.xcodeproj. This meant that even though everything worked fine locally, whenever the CI tried to run pod install it failed.