How to get cocoa pods to work? - ios

I have installed cocoapods. I've done everything that I've seen online, yet I can never successfully import a 3rd party framework into my project. I have tried many, many times--at least 20 probably, and have not once been able to successfully do this. Take for example, this library: https://github.com/uacaps/PageMenu
I added the podfile, I ran "pod install", that worked, I opened up the workspace and not the original project, I added the framework under "linked frameworks and libraries." But it still says "No such module Page Menu." It does this for every single pod that I try to install. What am I doing wrong? From what I've read everyone seems to think they are so easy to install. And they are, problem is they just never work once I do install them. Is there some missing step that everyone else knows about that I don't? I have looked under build settings and I've read something about changing the linker flags, but I couldn't figure out how to do that. I have tried installing the library manually and that didn't work either. Could it be that something is just wrong with my Xcode? I've been having this problem for a few months, and it has stayed consistent since I updated my Xcode recently. Does anyone have any idea what this could be?
edit: link to Podfile photo:
http://i58.tinypic.com/2lc2zqb.png

First,make sure that you have something like this in your PodFile (same folder as your xcode proj)
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'PageMenu'
then cd to the directory and do pod install in terminal.
I am assuming that you are using swift. Build the project. Go to your report navigator.
EDIT:: Do open the proj using xcworkspace instead of xcodeproj
You should see something like this.
This tells you what you have to add in your bridging header.
To create a bridging header, create a random objective c file (with cocoa touch class). XCode will ask you if you want to create bridging header.
Select yes, then delete the files you just created. Next, go to the generated bridging header file. Add in
// this header should be based on the name you see in report navigator.
#import <PageMenu/PageMenu-Swift.h>

Look, Calm Down..
I had the same problem.Didnt give up.try doing this as well,worked for me
create new project
close xcode
go to target folder pop init
open -a Xcode Podfile-uncomment platform -pod 'PageMenu' ( I typed this outside target this time/not like the usual way typing it inside target- do/ ,save and close)
open xcodeworkspace and Type - import PageMenu -( still says unresolved module )
Now Build ..
(worked for me, It somehow works with clean or Build i suppose ,so try both)

Related

no such file or directory: 'SwiftyJSON'

I want to ask why my swiftyJSON.framework in a linked library like disable. I already install that framework before, but suddenly I got that message when I run the project, I already remove and reinstall using pod but when I add that framework to my linked library, its show like disable
here the screenshot;
please help.
Create proper podfile where you declare platform and your target (last part of bundle identifier). Make sure they are the same as in your Xcode project settings. When you run pod install you will notice that the file .xcworkspace was created. Open it with Xcode and you should be good to go - just remember to import SwiftyJSON each time you want to use it.
Here you have a swiftyJSON documentation for further reading.
Try to pod install with no SwiftyJSON in your podfile. SwiftyJSON.framework should be removed completely from your Xcode, if not, you have to remove it by yourself.
And then add it back to podfile and pod install again.
You might want to delete your Derived Data folder which is location in /Users/username/Library/Developer/Xcode/DerivedData. As well as this, you might want to do a project clean as well as a folder clean like so:
Project clean:
Shift + command ⌘ + K
Folder clean:
Shift + alt + command ⌘ + K
Make sure your project name isn't the same as the framework name as Xcode doesn't seem to like that and can cause the same error. I hope this helps.
AH , I just solved my problem , it caused by Other linker flag in build settings, i remove all at first and add $(inherited) again , sorry i got mistake to delete one of framework inside there before. thanks , case closed
Try to follow there step:
Click to framework/project you working on.
Remove framework cause error from framework folder
Move to trash Pods folder
Go to target
Choose Build phase
Click x button at trailing of "[CP] Check Pods Manifest.lock"
Clear build folder
Clear data in DerivedData: File>Workspace setting>Users/admin..DerivedData. Delete data in folder hold this project data
Back to terminal and hit "pod update"

All Pods not recognized after starting the process of adding to app store 'No such module' error

My app worked just fine until I started the process to upload to the app store and somewhere during that process, I started getting the error 'No such module'.
I have tried different pods, same result
I have tried a new blank project with just the import line (after importing the pod), same result
After eliminating the pod it self and the project, it has got to be a setting that got changed that won't allow it to see the pod files. If anybody has any thoughts, I would be greatly appreciative.
*edit: Taking Dershowitz123's advice, I have tried changing the path for the frameworks to
$(SRCROOT)
screenshot1 (sry, I don't have the reputation to post embedded images yet).
I still get a failed build, but I think you are in the right direction. I noticed that it isn't finding the framework file.
screenshot2
I've looked for the file listed and I don't see one in the directory anywhere. When I made my blank test project, it also didn't create a Pods_RiskAssement.framework file (or similar named file).
*edit 2
here's my Podfile:
# Uncomment this line to define a global platform for your project
# platform :ios, '8.0'
# Uncomment this line if you're using Swift
use_frameworks!
target ‘RiskAssement’ do
pod ‘SimplePDF’
end
*edit
Resolution. I was unable to figure out how to import the pod, but was able to copy the swift file data and embed it directly into the code for my app. This way I didn't need to reference the pod and was able to build the app.
I'm not sure why this is actually happens, but one way to solve your issue is to go into your build settings and defining the Framework Search Paths to a folder which contains the frameworks in question. If the frameworks are placed in your project directory, simply set the framework search path to $(SRCROOT) and set it to recursive.
I recently received the same 'No such module' message for the different PODS that I had installed. The resolution for me was to select the PODS project in my workspace, select all of my targets, and then manually build them using either the menu command or the Command B shortcut. After it finished building the errors went away.
I hope it helps!

'Framework not found' in Xcode

I know this has been asked a couple of times. I followed instructions from these ones:
Adding frameworks to project in Xcode 5 and having *relative* paths added
xcode4: Linker error: Directory not found for option
Still Xcode is giving this error:
Here's my current configuration:
The bolts framework is so I can use the Parse SDK. I downloaded the blank project from here: https://parse.com/apps/quickstart#parse_data/mobile/ios/native/new
It's working. I tried to copy every config option, but it still doesn't work.
Try deleting Bolts.framework from linked framework and re-add it. Also, in your Framework Search Path keep path until Bolts.framework like $(PROJECT_DIR)/Bolts if it is inside Bolts folder at your project directory path.
I'm pretty new to iOS development. Apparently this problem for me was a result of opening the .xcodeproj Xcode project instead of the .xcworkspace Xcode workspace. I opened the workspace instead and the error has gone away.
error: Framework not found
If you use CocoaPods try to run:
pod deintegrate
pod update
Also use .xcworkspace instead of .xcodeproj
Delete the framework link from the Xcode project setting.
Move the framework to the Project Folder.
Re-add the framework in the Xcode project setting.
clean the project and re-compile it.
delete all frameworks from Embedded Binaries and re-add it
me too was getting this error , I moved the framework file to the root project folder and added to framework again and problem is solved.
1:- Delete the framework from the Xcode project. Quit the Xcode.
2:- Open your project in XCode and go to file under Menu and select Add files to "YourProjectName".
3:- Select "YourFramwork.framework" in the directory where you keep it.
4:- Click on the Copy items if needed checkbox.
5:- Click Add.
Make sure that you have the framework added in both Embedded Binaries and Linked Frameworks and Libraries under Target settings - General. As shown in the following images:-
Here is the solution :
Turn the "$(PROJECT_DIR)" attribute(might be non-recursive by default) into recursive option in Select Project Click on Targets Click - Build Settings Search for 'Framework Search Path' - Double click the input.
Scratched from https://stackoverflow.com/a/31298214/4493512
Besides from removing the framework from the Podfile and Linked Frameworks and Libraries, I also had to remove the reference to the framework in Other Linker Flags.
I just had the same situation (was having a hard time to address the OP's build error after adding a 3rd party framework) and it seems like a bug in Xcode (mine is 8.3.2 (8E2002)).
The problem was that a folder name in path to the framework contained spaces. In this case, Xcode incorrectly escaped them with backslashes like this in Build Settings -> Framework Search Paths:
$(PROJECT_DIR)/Folder\ with\ spaces/Lib
To fix this, just manually edit the entry to remove those backslashes and enclose the whole string in quotes like this:
"$(PROJECT_DIR)/Folder with spaces/Lib"
Delete the framework that is causing the issue (by removing the reference).
Then add it again, following these steps for adding FBSDK frameworks and libraries:
click project
general settings
linked framework and libraries
click the plus button and add all that you want
None of the above worked for me until I found that I had a blank "Any Architecture | Any SDK" line underneath Framework Search Paths / Debug under Build Settings.
Deleted the line and it works!
Error: Framework not found
If you use CocoaPods try to run these commands from terminal:
Intel chip:
pod deintegrate
pod update
Apple Silicon M1 chip:
pod deintegrate
arch -x86_64 pod update
Also use .xcworkspace instead of .xcodeproj
When this error occurred to me was because Pods folder was in iCloud and had no local copy on my computer. Go to your project's folder in Finder and check if there is iCloud's symbol in any of the folders inside it!
I realised that I hadn't run/built my framework with the Generic Device, which strangely lead to these issues. I just put the framework back in and it worked.
If you are using CocoaPods. Similar thing has happened to me. Although this question is old someone like me might still be struggling. So for to help:
after pod install it warns you about project files. I didn't notice till now. it says:
[!] Please close any current Xcode sessions and use
ProjectFile.xcworkspace for this project from now on.
So basically, do not continue working on .xcodeproj after installing Pods. If you do linker won't find files.
My framework has long name like FrameworkSDK_Light-1.0.6.framework so I renamed it to FrameworkSDK_Light.framework and it solved my problem.
I got the error 'AdBrixRM framework not found'. I checked the AdBrixRM.framework. I noticed that 'AdBrixRM' excution file is missed. I copied this file into the framework folder and the issue was gone.
I used to encounter this same exact issue in the past with Google Admob SDK. Most recently, this happened when trying to add Validic libraries. I tried the same old good trick this time around as well and it worked in a jiffy.
1) Remove the frameworks, if already added.
2) Locate the framework in Finder and Drag & Drop them directly into the Project Navigator pane under your project tree.
3) Build the project and Whooo!
Not sure what makes the difference, but adding the frameworks by the official way of going to the section "Linked Framework & Libraries" under project settings page (TARGET) and linking from there does not work for me. Hope this helps.
I found that the file.framework was referencing a file outside my project. So I dragged the file into my frameworks folder under my project and then got rid of the earlier file.framework file and it worked.
add github "BoltsFramework/Bolts-iOS" on your cartfile.
then carthage update.
after copy Bolts.framework from ../carthage/Build/iOS
Switching from iOS simulator to real device solved the problem for me.
Was facing the same error and solved it ---> Build Settings > Build Active Architecture Only = Yes
Please after adding both framework also open each Bolts and Parse framework and add Parse and Bolts to the project then problem will be solve
Running pod update in the root directory of the app fixed the issue for me.
If you are developing one module using cocoapods, try to comment the line
s.vendored_frameworks = "YOURMODULE.framework"
on YOURMODULE.podspec
The error will disappear after you generate and copy your YOURMODULE.framework to your project folder.
I had this issue on one of the project i worked, before you delete and readd the framework do a:
git status
on your project and check to see if the framework is not listed as deleted. In the event that it is either do a
git stash
or
git checkout *framework/file/path*

CocoaPods not building target for Crittercism

I added pod 'CrittercismSDK' to my Podfile and ran pod install, it finished with no error, all good.
Using import Crittercism gives No such module error. I looked into the Pods/ directory, there source code is there; however, the Pods project doesn't have a target called Pods-MyProject-Crittercism (but it does have targets for each dependency).
Build keeps failing because the import isn't found. What am I doing wrong?
PS: I'm using use_frameworks! directive in my Podfile, and I have another obj-c library that works fine, so I don't know why this one isn't working.
While this is not a general answer, I have found that:
Not using #use_frameworks
Using a Bridging-Header.h containing #import "Crittercism.h"
Not importing CrittercismSDK in the Swift class, but merely executing Crittercism.enableWithAppID("appId") does the trick.
See if below steps helps in your case. What version of pod/Xcode in use? It will be great if you can share your pod file, thanks.
Install dependencies using Cocoapods and the use_frameworks! flag.
As you need to use a Objective-C dependency, create a Bridging header. You can create one easily by importing an Objective-C class to your Swift project, than remove it (the wizard should ask you if need a bridging header). Otherwise, create a new header file. Then, navigate to your target configuration and enter the name of your file in Swift Compiler - Code Generation > Objective-C Bridging header.
Still in your target configuration, add a new entry in Search Paths > User Header Search Paths: Pods as value and flag it as recursive.
Remove any import instruction from your code, relative to your Objective-C library.
Build your project. You should have a success.

"No such module 'Alamofire'" won't recognize framework

I am trying to add Alamofire to a new XCode project with Swift. I feel like I have tried everything.
Every time I try to add
import Alamofire
I get "No such module".
I have tried installing it as stated on https://github.com/Alamofire/Alamofire,
I tried doing it manually first, then Carthage and Cocoapods, but with the same result.
I have tried deleting the DerivedData folder and rebuilding the project without any luck.
It is a completely clean install, yet it just won't recognize the framework. I have tried the suggestions in the first 10 Google searches and here on Stackoverflow (Cannot install Alamofire in new Xcode Project. "No Such module Alamofire") Here are some screenshots from my latest manual attemp:
Looks like you are using the module by directly dropping the source files into your project.
If that's the case, you don't have to use import Alamofire header or use Alamofire( dot ) in the beginning of every method.
Just use the code as below omitting Alamofire tag.
request(.GET, "https://httpbin.org/get")
I know it's late answer, but I was facing same problem with Xcode 8 Swift 3.0. I follow this Alamofire link and added framework manually. Its working fine. One of my project stuck on 'no such module' error, I cleaned derived data (Cleaning derived data removed source files of Alamofire. I added it again in my project ;) ) and it works like charm :).
Followed instructions
Download Alamofire
Drag Alamofire project in your project directory
Check alamofire deployment target same as your project
Go to your project general settings, click on the + button under the "Embedded Binaries" section.
You will see two different Alamofire.xcodeproj folders each with two different versions of the Alamofire.framework nested inside a Products folder. It does not matter which Products folder you choose from, but it does matter whether you choose the top or bottom Alamofire.framework.
Select the top Alamofire.framework for iOS and the bottom one for OS X.
And that's it! The Alamofire.framework is automagically added as a target dependency, linked framework and embedded framework in a copy files build phase which is all you need to build on the simulator and a device.
same error here.
I solved the problem by the following steps:
Click on your project (targets)
Click on Build Settings
Under Search Paths-Framework Search Paths, add the directory path which contains Alamofire.framework
Hope this can solve your problem!
I was importing Alamofire and I ran into the same issue. Turns out the Cartfile was not in the same folder as the .xcodeproj file.
Once I moved the Cartfile, the Cartfile.resolved files and the Carthage folder to the same folder as the .xcodeproj file my project didn't trigger any errors.
Make sure to also add this line to Build Settings > Framework Search Paths:
$(PROJECT_DIR)/Carthage/Build/iOS
I was able to resolve this issue changing my Podfile. I originally had the reference to Alamofire in a target:
The problem disappeared when I changed the podfile to the following:
platform :ios, '8.0'
use_frameworks!
pod 'Alamofire', '~> 3.0'
pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'
target 'xxxxxxx' do
pod 'GoogleMaps'
end
target 'xxxxxxxTests' do
pod 'GoogleMaps'
end

Resources