Importing Alamofire 3.4 - No such module 'Alamofire' - xcode

I hava a project that need Alamofire imported and every aproach i took got me to same porblem
import Alamofire - No such module 'Alamofire'
Installed cocoapods
Edited Podfile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!
target 'my project name' do
pod 'Alamofire', '~> 3.4'
end
$ pod install
everything was smooth and had no errors in the proces from installing cocoapods to the end.
Opened project with projectname.xcworkspace
Even tried the manually and still the same problem - No such module 'Alamofire'
Thank you for the help in advance.

After adding a framework through CocoaPods, in most conditions you are supposed to clean and build the project right away.
That should take care of adding/building the new framework to your app and make it active for use
Also, please note that another copy of your project will be created upon addition with pods, called something like 'yourProjectName.xcworkspace' (You can find it in your directory). It will have a light blue color thumbnail. After adding your pods, you must start using that copy of your project instead of the normal project.
// Note : Generally with CocoaPods, when you add a pod to your Podfile, you just need to save the Podfile and type 'podinstall' in your terminal. Make sure to get to your project directory before that. That will import the frameworks automatically. However, you do need to write import statement in your file to use it obviously
You do not need to import Alamofire framework explicitly (if using Cocoa Pods) - Umair (in comments)

Do import Alamofire and then do Build. I think it's helpful.

I had a similar issue and solved it following the below listed steps:
Realized that <projectName>.xcworkspace is what you need to be using after adding a pod to your project
Deleted the pods folder and Podfile.lock and did a pod install
Set Architectures to Standard architectures (armv7, armv7s, arm64)
Set Build Active Architectures Only to Yes

I Faced the Same Issue During the Implementation
Step 1 :
Import Alamofire
Step 2 :
Keep on Pressing Build ( Cmd + B )
Step 3:
If Issue Continues then just close your program for a moment by
completely closing it(cmd + Q) and then Restart it and Follow Step
1 & 2
This will work
Thanks

If you install dependencies using Pods, and if you are working using .xcodeproj file, it will never build prompting no such module error. You should definetely switch to .xcworkspace and you will see everything's fine. If the error persists, you should clean the project or delete derived data.

Related

Using 'GoogleMaps' and 'GooglePlaces' pods, when archiving iOS build receive error for multiple commands produce GoogleUtilities target

Having trouble archiving - I receive a Build System Information error that says
Multiple commands produce '.../Library/Developer/Xcode/DerivedData/.../Build/Intermediates.noindex/ArchiveIntermediates/.../IntermediateBuildFilesPath/UninstalledProducts/iphoneos/GoogleUtilities.framework':
1) Target 'GoogleUtilities-00567490' has create directory command with output '.../Library/Developer/Xcode/DerivedData/.../Build/Intermediates.noindex/ArchiveIntermediates/.../IntermediateBuildFilesPath/UninstalledProducts/iphoneos/GoogleUtilities.framework'
2) Target 'GoogleUtilities-ac14cd06' has create directory command with output '.../Library/Developer/Xcode/DerivedData/.../Build/Intermediates.noindex/ArchiveIntermediates/.../IntermediateBuildFilesPath/UninstalledProducts/iphoneos/GoogleUtilities.framework'
I recently updated to the latest version of Xcode (v 10.0). I am also using Cocoapod version 1.6.0.beta.1
Using GoogleMaps pod version 2.7.0, GooglePlaces pod version 2.7.0
When I run 'pod install' it also installs 'GoogleUtilities (5.3.0)'.
I tried deleting my Podlock, Podfile, .xcworkspace, etc and starting over with a new Podfile, pod init, pod install, etc. after updating Cocoapods but still no luck.
I'm looking for a duplicate relating to GoogleUtilities or Places or Maps in Build Phases within Embed Pod Frameworks, but not having much luck. When I look inside the Pods folder, I do see two GoogleUtilities frameworks, "GoogleUtilities-00567490" and "GoogleUtilities-ac14cd06", but both appear not to have the exact same contents.
Only now experiencing this issue after updating Xcode to version 10.0.
For me, the same issue was coming and Most of the people saying to change the build system to legacy, but when I tried its It started swift compilers error. resolved as mentioned below.
Go to your target and click on (your_app_name_target).
Select Build Phases.
Expand Copy Pods Resources.
See the section Output Files.
This section should be empty. Remove any entry there.
Rebuild your Project.
Going to File > Workspace Settings and then changing the Build System from "New Build System (Default)" to "Legacy Build System" will allow you to archive for now. Hopefully, another solution comes along for using those pods and the new build system in Xcode 10.0

How to add a CocoaPod framework to Xcode 8 Playground

I tried to add some pods to the Playground within an Xcode project. Unfortunately, the only scope supported is targets since the update, and link_with is no longer supported.
ERROR:
[!] Invalid Podfile file: [!] The specification of link_with in the Podfile is now unsupported, please use target blocks instead.
When I use target blocks, I get this error:
[!] Unable to find a target named MyPlayground, did find Target_1, Target_2
OR:
[!] Unable to find a target named MyPlayground.playground, did find Target_1, Target_2
Also tried adding it within Target_1 target scope:
ERROR
[!] Invalid Podfile file: [!] Unsupported options MyPlayground for target Target_1.
What is the simplest way to add a dependency to Playground source?
UPDATE
As of:
Xcode 8.2
You no longer need to add your pod folder into resources, simply use it as you would in the project.
Example:
Pre Xcode 8.1
Thanks to Eric Aya, I have found a solution based on his first suggestion.
In order to add a CocoPods framework to Playground, follow these steps:
Add pods to your pod file and hit pod install
Add a new Playground file
Click on the Sources folder in your playground
Click on the + for Add Files to Sources
Add you pod folder, in our case HanakeSwift
Import your project pods framework import Pods_PodsPlayground
Build and access your framework!
Step 3
Step 4
Step 5
Step 6, 7
In Xcode 8.2:
Click on your project name in the left column
Click "New File" and choose "Playground"
Import the pod that you have installed in your Podfile
Possibly do a build and run to get rid of the error if it temporarily can't find the pod
That's it! You should be good to go

No such module ZFDragableModalTransition in Swift

I have a xCode project. I am trying to run FolioReaderKit. I've installed the all project requirements such as CocoaPods and Carthage and I've fixed the errors except ZFDragableModalTransition.
I've downloaded it and added into my project over and over, I've added it as a Link Binary but I'm still getting same error. "No such module ZFDragableModalTransition in Swift"
I am very new in swift and Xcode therefore I might be make a mistake but I didn't manage it yet.
Do you have any suggestion?
You can see the error attached images.
If you want to run the FolioReaderKit Example project and you are new to Swift and Xcode I suggest you to use Cocoapods instead of Carthage. You don't have to run FolioReaderKit.xcodeproj.
Just go to Example folder and follow this steps:
Open the Terminal on Example folder;
Run pod install (you need Cocoapods installed);
Open Example.xcworkspace file on your Xcode and run;
To add this you your project using Cocoapods create a Podfile and add:
use_frameworks!
target 'MyApp' do
pod 'FolioReaderKit', '~> 0.7'
end
Then use pod install to install it to your project, the usage documentation is in the Example project.

Cocoa Pods without workspace?

I have read about a possibility to add CocoaPods to an XcodeProject without getting the xcworkspace file, instead you get a xcodeproj file that you can integrate into your current project. How can I do that? Would love to use the xcodeproj file instead of xcworkspace.. I'm programming in swift (if that makes any difference).
Yes, its possible. But, we need to do few steps to proceed.
Check this Github thread.
The below line in pod.file will not let the client integration process.
install! 'cocoapods', :integrate_targets => false
We can drag and drop the Pods.xcodeproj to the main project
Link the target dependencies and Link Binary with Libraries in Build phases.
Thats it.
You can not do this.
The CocoaPods website guide to using CocoaPods found here directs you to using the .xcworkspace it creates. Several other guides found across the Internet all direct you to use this file indicating that using the .xcodeproj file will now result in build errors.
There is simply no evidence that this is a possibility at all.
From the CocoaPods website guide on using CocoaPods:
Save your Podfile.
Run $ pod install
Open the MyApp.xcworkspace that was created. This should be the file you use everyday to create your app.
More from their website:
Now you can install the dependencies in your project:
$ pod install
Make sure to always open the Xcode workspace instead of the project
file when building your project:
$ open App.xcworkspace
And from the Ray Wenderlich guide regarding using CocoaPods with Swift:
Open the project folder using Finder, and you’ll see that CocoaPods
created a new IceCreamShop.xcworkspace file and a Pods folder in which
to store all the project’s dependencies.
And from an NSHipster article on CocoaPods:
CocoaPods will create a new Xcode project that creates static library
targets for each dependency, and then links them all together into a
libPods.a target. This static library becomes a dependency for your
original application target. An xcworkspace file is created, and
should be used from that point onward. This allows the original
xcodeproj file to remain unchanged.
In older versions of cocoapods it was possible to install and update pods with the option '--no-integrate'. It allows you to create a library project, which could be imported into an existing project (read more). But this option is missing now. I've build a Xcode project for a maven-build with this option earlier. Today I've updated the pods of this project with the newest cocoapods version (1.0.0) but without the '--no-integrate' option and it still works. So eventually there is a way...

Why does installing a cocoapod create missing files in xcode?

I installed cocoapods on my machine.
I added a podfile to my project and then ran pod install.
The resulting file structure that xcode picks up, seems to contain a number of missing files in Frameworks and Products.
Is this expected behaviour? I deleted the pod files and directory and recreated them again using pod install. Same result. I started a new project and did the same. Same result.
If this is expected behaviour, what am I looking at here? Why are there missing files? (if indeed that is what the files being red means).
I don't yet know what the "Products" or ".framework" files are for.
My podfile looks like this:
# Uncomment this line to define a global platform for your project
platform :ios, '9.1'
# Uncomment this line if you're using Swift
use_frameworks!
target 'Hospital Demo' do
pod 'HLSpriteKit'
end
(aside: It's not causing my an build errors, and the app so far runs fine. Don't know if it makes any difference, but I'm using swift.)

Resources