Alamofire "installation" not working (red text in Embedded Binaries) - ios

I am trying to add Alamofire to my xcode v6.3.2 project but it's not working for me. I followed all the steps in the readme from the github repo but when I select the framework to add as an "Embedded Binary" it shows with red text and is not available to me in code.
Does anyone know why this might be? I also tried to add to a brand-new, blank project with the same results.

I'd advise you to use CocoaPods. Here is how you do that:
First get Brew. Open up a terminal and paste this in there:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Then get CocoaPods. To do that run this command in the same terminal:
sudo gem install cocoapods
After you've done that navigate to your Xcode project in the terminal (be sure to replace YourProjectHere with your project's name):
cd ~/Documents/XcodeWorkspace/YourProjectHere
In this folder run the command:
pod init
After running pod init a file will have been created called: Podfile. Edit this file by typing:
vi Podfile
At first this file will contain:
# Uncomment this line to define a global platform for your project
# platform :ios, '6.0'
target 'YourProject' do
end
target 'YourProjectTests' do
end
Edit it to contain this:
# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
use_frameworks!
target 'YourProject' do
pod 'Alamofire', '~> 1.2'
end
target 'YourProjectTests' do
end
Now completely exit out of Xcode and run this command in terminal:
pod install
Last but not least! Type the following command:
open YourProjectHere.xcworkspace
Everything should be up and running! Make sure to include the following in the class where you'd like to use the Alamofire framework:
import Alamofire

I followed the instructions posted in the Alamofire page and you're right it happens , but even it works too.
Just build the project, and then you can put import Alamofire and make requests without problem.
I hope this help you.

Related

No such module 'AWSCore'

Im new to swift and going through a Tutorial on integrating AWS tools and I keep getting this error, " No such module 'AWSCore' "
However, on the left, you can see these modules are downloaded and there in the pod File.
My question is how to get rid of these errors and correctly import those features. Any help on how to fix this problem will be much appreciated!
re-create a new 'Podfile' on the Root folder of your Xcode project by running the command:
$ pod init
Now make sure your 'Podfile' contains the AWSCore module like shown below.
platform :ios, '9.0'
target :'MyNotes' do
use_frameworks!
# Analytics dependency
pod 'AWSPinpoint', '~> 2.6.10'
pod 'AWSCore', '~> 2.6.10'
# other pods
end
Kindly note for every module you import in your project you will need to include it in your 'Podfile' and then update the 'Podfile' by running the command :
$ pod install
or
$ pod install --repo-update
Close the Xcode project and then open the *.xcworkspace file to relaunch Xcode
I was able to get past this issue by adding $(BUILD_PRODUCT_DIR) ------ recursive. I added it to me release settings as well.
Do not open PROJ.xcodeproj but rather open PROJ.xcworkspace in some case to build pods.
In your case, other answer should lead to right way.

Unable to Install cocoaPods in already existing Xcode project

I do have an existing project in Xcode (swift 3) in which a detailed UI has been designed. I am still unable to install CocoaPods into that project.
All the guides I've seen on how to install cocoa pods people CREATE A NEW PROJECT and install it in that NEW PROJECT, however, I want to install it in an existing (designed UI) project. Trying to install cocoa pods in that project lead me to a workspace that shows everything empty and red lines everywhere on the left see the screenshot and suggest a solution, please. Thanks!
Please follow the below steps for installing pods to an existing project:
Open Terminal and navigate to the directory that contains your project by using the cd command:
cd ~/Path/To/Folder/Containing/Project
Next, enter the following command:
pod init
This creates a Podfile for your project.
Finally, type the following command to open the Podfile using Xcode for editing:
open -e podfile
It opens the podfile for you.
Now edit podfile to add required frameworks. it should look similar to below snippet.
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'ProjectTarget' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
pod 'Firebase/Messaging'
# Pods for ProjectTarget
target 'ProjectTarget-iOSSDKTests' do
inherit! :search_paths
# Pods for testing
end
target 'ProjectTarget-iOSSDKUITests' do
inherit! :search_paths
# Pods for testing
end
end
Then after pods will be integrated to the project and .xcworkspace will be created.
Next time open the .xcworkspace to continue with the project.

How to add cocoapod to ios framework

I am working on ios project, where I am using EVReflection library in project,I am having one custom framework there I am using EVReflection for that I have taken cocoapod i added after that I am trying to build framework it is not building and one more my project is also using Evreflection so if I add my custom framework to project will it add automatically import Evreflection there also.
SampleFramwork i am adding evreflection
code:
platform :ios, '9.0'
target 'SampleFramework' do
use_frameworks!
pod "EVReflection"
end
Install POD
[ 1 ] Open terminal n type:
sudo gem install cocoapods
Gem will get installed in Ruby inside System library. Or try on 10.11 Mac OSX El Capitan, type:
sudo gem install -n /usr/local/bin cocoapods
If there is an error "activesupport requires Ruby version >= 2.xx", then install latest activesupport first by typing in terminal.
sudo gem install activesupport -v 4.2.6
[ 2 ] After complete installation, there will be a lot of messages, read them and if no error found, it means cocoapods installation is done. Next, you need to setup the cocoapods master repo. Type in terminal:
pod setup
And wait it will download the master repo. The size is very big (370.0MB at Dec 2016). So it can be a while. You can track of the download by opening Activity and goto Network tab and search for git-remote-https. Alternatively you can try adding verbose to the command like so:
pod setup --verbose
[ 3 ] Once done it will output "Setup Complete", and you can create your XCode project and save it.
[ 4 ] Then in terminal cd to "your XCode project root directory" (where your .xcodeproj file resides) and type:
pod init
[ 5 ] Then open your project's podfile by typing in terminal:
open -a Xcode Podfile
[ 6 ] Your Podfile will get open in text mode. Initially there will be some default commands in there. Here is where you add your project's dependencies. For example, in the podfile, type
pod 'EVReflection'
(this line is an example of adding the AFNetworking library to your project).
Other tips:
Uncomment platform :ios, '8.0' Uncomment user_frameworks! if you're using Swift
When you are done editing the podfile, save it and close XCode.
[ 7 ] Then install pods into your project by typing in terminal:
pod install
Depending how many libraries you added to your podfile for your project, the time to complete this varies. Once completed, there will be a message that says
"Pod installation complete! There are X dependencies from the Podfile and X total pods installed."
Now close your xcode project and open .xcworkspace xcode project file and start coding. :)
Configuration should look something like this:
1) Open terminal and locate your project root
2) write: pod init
3) write: atom podfile (or nano/vim/some other texteditor)
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
# Public spec repository
source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!
target 'ProjectName' do
# Pods for ProjectName
pod 'EVReflection'
end
4) write: pod install
5) close all of your current xcode projects, and open project.xcworkspace file
Use the format below in Podfile
use_frameworks!
target "YourProjectName" do
pod 'EVReflection'
end
If it is not building yet , add it to Embedded Binaries and Linked Frameworks and Libraries

library not found after cocoapods integration

Integrated (objective C) Xcode 7.2 iOS 9.2:
$ mkdir -p $HOME/Software/ruby
$ export GEM_HOME=$HOME/Software/ruby
$ gem install cocoa pods (automatic pods version (0.39))
$ export PATH=$PATH:$HOME/Software/ruby/bin
$ cd/ to project folder
$ pod init
$ open -a Xcode 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 'ProjectName' do
pod 'AFNetworking', '~> 2.0.3'
end
target 'ProjectNameTests' do
end
$ pod install
Xcode gives error "library not found for -lAFNetworking"
Searched around google: Tried with things:
Removed everything from target>build setting>otherlinkerflag, except $(inherited), compiled but unlucky
Deintegrated pods plugin from (https://github.com/CocoaPods/cocoapods-deintegrate) again installed compiled but unlucky
Tried experiment with header search path & framework search path but unlucky.
Did you open Workspace or Project file? Verify that you open first one
Make Sure Pods is completely instally !!!
and open Workspace file geneterated after pods is installed !!

Cocoapods Installation

Dears,
I have this case I am trying to make this Control work:
https://github.com/mikaoj/BSImagePicker
Its a image picker that needs to be installed using Cocoapods. I know its a newbie question.
But i downloaded the Installed cocoapods and then went to my example folder and ran the "pod install" and it was successfull:
"Pod installation complete! There is 1 dependency from the Podfile and 3 total pods installed."
So everything should be great. But when i open the project and try to run it, This error occurs:
"No such module 'BSImagePicker'"
I cant get how things work here. Is there is any further steps should i do after "pod install" I am new for cocoapods. Maybe something i missed.
Your support is appreciated
Thank you
Three points:
Make sure your pod file has use_frameworks! line uncommented. if not, uncomment and reinstall pods.
Make sure you have opened the workspace, not the project file. Clean (Cmd+Shift+K) and Build (Cmd+B).
In the code where you want to use the BSImagePicker, make sure you import it i.e. import BSImagePicker
I just tried it and it works fine, here's what the Podfile looks like:
# 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 'ExampleApp' do
pod "BSImagePicker", "~> 2.2"
end
target 'ExampleAppTests' do
end
target 'ExampleAppUITests' do
end

Resources