How to install Quick and Nimble in Xcode 6.3 - ios

I've tried both cocoapods and git submodules but everytime I install the framework it wont build. Has anyone been able to install it. Both quick and nimble I use the code on the master branch. I also am using Swift 1.2 with xcode 6.3. It seems the framework is not getting compiled into the project. I realize sometimes when you link a framework to the workspace it goes red in the build phase area but would still work. But my quick and nimble framework references turn red randomly. I've set them in my test target only and tried to create a quick test in Objective-C and also tried swift but it just says build failed and then the framework link goes red. Has anyone been able to install it?
the formal install instructions should be here
UPDATE: I'M ABLE to install quick and nimble (on master branch) using cocoaPods but not git subModules. The project I'm using I've been instructed not to use Pods so I need to use git subModules. the IDE reports the following error and fails any test:
IDEBundleInjection.c: Error 3587 loading bundle '/Users/someUserID/Library/Developer/Xcode/DerivedData/myproduct-aadhzxcsaigkzsgjyneytqrocsjc/Build/Products/Debug-iphonesimulator/myproductTests.xctest': The bundle “myproductTests” couldn’t be loaded because it is damaged or missing necessary resources.
DevToolsBundleInjection environment:
XCInjectDiagnostics: (null)

edit Podfile
use_frameworks!
target 'YourAppNameTests' do
pod 'Quick'
pod 'Nimble'
end
run
pod install

Follow the steps to reliable setup of Quick and Nimble:
Prerequisites:
cocoapods installed in your machine (installation Guide)
1) create a new Xcode project
Xcode—> File —> New —> Project
2) Select Single View App (Normally most of the application use this) —>Next
Enter Product Name (App NAme) - (here we are using WeatherForecast)
enable check mark for Include Unit Tests
3 )Installation
Open terminal
Move to your working directory cd (path of your project folder)
Ex: enter in terminal
cd /Users/Documents/ WeatherForecast
4) Initialise pods with
Pod init
5) Open the newly created Podfile within your favourite text editor.
edit podfile with below contents
platform :ios, '9.0'
target WeatherForecast’ do
use_frameworks!
target 'WeatherForecastTests' do
inherit! :search_paths
pod 'Quick'
pod 'Nimble'
end
5) Save the podfile.Return to terminal and
enter pod install in terminal
6) This will install your new frameworks and create a pods project. It will also generate a workspace. You should now use the new workspace when working on your project. So if you’ve opened your project already close it and in open the WeatherForecasr.xcworkspace instead.
7) Setting up your test class
Within your tests target create a new group and file by:
Highlighting WeatherForecast Tests.
File —>New—> Group
Rename the new Group ModelTests
Highlight your new group
File —>New —> File
Select Swift file, Press Next
Name the new file CurrentSpecs . Press create
7) Within your new file replace the contents with the following
import Foundation
import Quick
import Nimble
#testable import WeatherForecast
class CurrentWeatherSpecs: QuickSpec {
}
After this you might face an error
“No such Module Quick”
“No such Module Nimble”
Below steps worked to Fix the error
Try the Following:
open Xcode schemes list
tick Nimble and Quick with “show” and close.
Select Nimble as a scheme and build (cmd + B)
Select Quick as a scheme and build(cmd+B)
Change scheme back to your app scheme and see if the error is gone and autocompletion works
This is what I have to do from time to time

Turns out if i add a single swift file to the test then all of a sudden the IDE can link the frameworks quick and nimble together. Very frustrating this was not in the README file.
solution: create a single swift file and add to your test target:
// Swift_Spec_doNotRemove.swift
import Quick
check here for further info.

Related

After installed framework from pods, not able to import in class in Swift project

I have installed some framework by pod file in my Xcode project. I am using Xcode 9.2. Its installed successfully, but, while trying to import that third party framework to my main class, showing no such module found.
Even tried so many times complete clean and rebuild. But, still showing the error No such module found OR Cannot load underlying module for XLPagerTabStrip.
In framework search paths it's showing like below PFA.
If you face No such module found XLPagerTabStrip, then:
1) Click on your app name on side of a select simulator for a run and click on the manage scheme.
2) Try to find XLPagerTabStrip And checked it and close it.
3) Then click on the app name where you can see XLPagerTabStrip.
4) Then click on it then clean build project and again choose your app and then again clean and build.
where you have to click in the screenshot. you can find Demo
Couple of things you can follow :
Clean project + Remove derive data and build again.
Check the Pods project on Xcode and make sure your pod exists in the Pod folder under Pod project.
Add the Pod in Embedded Framework in project settings.
Edit your scheme :
Scheme menu > Manage Schemes > check Pods > Close
Select Pods from the scheme menu.
Build Pods.
Select your project from the same menu, then build/run it.
Reinstall Pod :
pod deintegrate
pod install
Make sure you are correctly setting the pod in Pod file. Refer to original Github page of the library for the correct format.
First clean your code
right after pod installation is complete, build it once. Don't import pod files till now.
After build is succeeded now you will be able to import pod files.
You can try going to
General -> Linked FrameWorks and Libraries
Click on plus button and search your installed pod(installed as framework, if UserFrameWork! is mentioned in podFile) and press Add.

How to manually import third party Swift framework into Swift iOS project?

I am trying to import and use the OAuthSwift library in the Swift iOS project. I followed their directions:
Drag OAuthSwift.xcodeproj to your project in the Project Navigator.
Select your project and then your app target. Open the Build Phases panel.
Expand the Target Dependencies group, and add OAuthSwift framework.
import OAuthSwift whenever you want to use OAuthSwift.
After completing these steps, importing OAuthSwift using import OAuthSwift causes the error No such module 'OAuthSwift' and the project fails to build.
I have tried the following steps, based on a number of other SO questions about similar issues:
Clean and rebuild
Add the OAuthSwift framework to many different combinations of Build Phases > Target Dependencies, Build Phases > Link Binary With Libraries, Build Phases > Embed Frameworks, and General > Embedded Libraries
Set Build Settings > Search Paths > Framework Search Paths and Build Settings > Search Paths > Library Search Paths to $(SRCROOT) and recursive.
Verify that my deployment target matches the deployment target of the OAuthSwift Xcode project.
I have tested this using the latest version of OAuthSwift from their master branch using a git submodule, as well as manually downloading and importing each of the two latest tagged versions (0.6.0 and 0.5.2).
I have also created a brand new Xcode project, imported OAuthSwift as above, and encountered the same error.
Finally, I also tried importing a different Swift Framework (Alamofire), following the steps as stated on the README at https://github.com/Alamofire/Alamofire. This caused the same error as well: No such module 'Alamofire'.
I am using:
OSX 10.11.6
Xcode 7.3.1
Swift 2.2
I'm still fairly new to Xcode and the Swift module system, so any help or suggestions is appreciated.
Your life will be a lot easier if you import the framework using CocoaPods. If you haven't used them before, it's really easy once you get set-up. You use Ruby Gems on the command line to install CocoaPods (sudo gem install cocoapods) and then create a create a pod file using pod init. After this you modify it to include:
platform :ios, '8.0'
use_frameworks!
pod 'OAuthSwift', '~> 0.5.0'
Save the file and run pod install.
Once this is complete you will have to close out the Xcode project and use the newly created .xcworkspace project file (not the .xcodeproj) from here forward.
Here is a link to another post for a secondary reference.
How to install cocoapods?

Integarte/Install cocoapods to existing xcode project, objective-c or swift

I was looking for integrating cocoapods to my existing xcode projects.
I found these few post but they are based on issue instead my problem.
not able to acess installed pods framework
How to add cocoapods to existing workspace not project (this one is for work-space not project)
Making a CocoaPod from an existing Xcode project (this one is more on integrating swift with objective c project)
So I spending quality time i did for my project.
I am sharing step by step integration in my answer post.
please feel free to suggest and improvement.
happy to learn and share
Install CocoaPods on System
Step.1 Open Terminal and enter the following command:
sudo gem install cocoapods
Create Podfile for Project
Step.2 now you need to close Xcode.
Open Terminal at project's root folder
Step.3 Next, enter below command to create podfile:
pod init
Edit podfile
Note: Make sure we will edit podfile with Xcode not TextEdit etc.
Step.4 Type this command to open the Podfile using Xcode for editing:
open -a Xcode Podfile
Step.5 update pode file as shown below screenshot, save and close.
Install lib/framework
Now we have added our required lib/framework pod command
pod 'SwiftForms'
let's go for install
Step.5 Enter the following command in Terminal and hit Enter
pod install
Result screen
Thats it!! we have done.
Open Project with pods
Now go to the project folder,we can see that CocoaPods created a new project_name.xcworkspace file and a Pods folder.
open project_name.xcworkspace with xcode
your project structure should look like

Alamofire No Such Module (CocoaPods)

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.

"GoogleMobileAds/GoogleMobileAds.h" file not found error

Recently I tried to update admob SDK(iOS) to the latest version(7.0.0)
I have trouble importing the framework.
It keeps giving me this error "GoogleMobileAds/GoogleMobileAds.h" file not found
I removed the old admob sdk and imported the framework manually.
I've tried
restart xcode
cleaning the project (command + shift + k)
remove the framework and add it again
No luck, any ideas to solve this? thanks.
Answer is to change the 'Framework Search Paths' build setting to the folder where your 'GoogleMobileAds.framework' is located.
Full steps I did to solve:
Remove references to the framework from project navigator
Click on your project in the project navigator, then on your project under 'TARGETS', then click 'Build Phases'
Expand 'Link Binary With Libraries'
Select 'GoogleMobileAds.framework' and click the '-' (if it's there)
Click the '+'
Click 'Add Other...', find and select 'GoogleMobileAds.framework' and click 'Open'
The google ads framework should now be in the list
Click 'Build Settings'
Change 'Framework Search Paths' to the folder where your 'GoogleMobileAds.framework' is located
Clean and re-build project
Right click on framework --> show in finder --> Delete framework from that place.--> go to the project and see at your framework place , its in red color .
Again right click on that and delete it. Again run project and save project . i know the build not successful.
Again add the framework and then run before that clean your project.
In Xcode Settings, change below settings
Enable Modules (C and Objective-C) YES
don't drag framework in your project..
just only copy past in your project folder and add files TO in your project..
i think it's 100% working.
This is the Solution
#1 Open Terminal install Cocoapods -> $ sudo gem install cocoapods
#2 Open Terminal and Enter Path of Your Directory -> cd desktop/gamebuild
#3 Enter this on Terminal -> Pod Init
#4 Go To Directory Paste This Line in Podfile -> pod 'Google-Mobile-Ads-SDK'
#5 Close File and Enter this on Terminal-> Pod install
After a days of web scraping i found a solution..You can follow the guide on the google ad mob official page.I have added the link...
https://developers.google.com/admob/ios/quick-start#cocoapods
After several tries, I've finally managed to build my app (from a Unity project).
It took several steps from different answers here, so I'm posting the detailed steps of what I did.
(I also want to practice formatting skills here in SO. lol)
Overview:
The goal is to install admob cocoapod then set the FrameWork paths.
Yes, these have already been mentioned above but they come from different answers which was a bit confusing for me.
Steps:
Close Xcode if you have it running.
Open a Terminal window and enter the following:
sudo gem install cocoapods
This will install cocoapods
In the same Terminal, cd to your Xcode project directory:
cd Documents/MyGitHub/MyNiceApp
Enter the following:
pod init
This will create a pod file in the project directory
Open the pod file in a text editor and do the following:
Uncomment the line for the platform (update the values if necessary)
In the section for Pods, add pod 'Google-Mobile-Ads-SDK', '7.26.0'
You can specify a version or leave it out to get the latest, like this: pod 'Google-Mobile-Ads-SDK'
The File should look something like this:
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'MyNiceApp-iPhone' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for MyNiceApp-iPhone
pod 'Google-Mobile-Ads-SDK', '7.26.0'
target 'MyNiceApp-iPhone Tests' do
inherit! :search_paths
# Pods for testing
end
end
Back in the Terminal window where you cd'ed to your Xcode project, enter the following:
pod install --repo-update
This will install the admob framework and save it in your Xcode project directory
Open Xcode with your project or workspace
In Project Explorer, look for Pods > ... > GoogleMobileAds.framework
Copy the Full Path from the properties, it would look something like this:
/Users/mickeymicks/Documents/MyGitHub/MyNiceApp/Pods/Google-Mobile-Ads-SDK/Frameworks/frameworks/GoogleMobileAds.framework
Note: the path contains the "GoogleMobileAds.framework" at the end
Open Build Settings for your TARGETS
Look for Framework Search Paths, double-click then add a new row for it.
Paste the path you just copied.
Clean the project then Build.
I recently had the same error. It was fixed really easy: I needed to open the .xcworkspace file instead of .xcodeproj.
Also did install pods beforehand but not sure if it contributes to the solution :)
Looks like they have some specific dependences and must be added to folder where is located .xcodeproj
this is actual for modul import and without pods: #import GoogleMobileAds;
I have tried to put the GoogleMobileAds.framework\Versions\A\Headersfolder to GoogleMobileAds.framework folder and it worked for me.
Note:
You must delete Header file first. It's already here in GoogleMobileAds.framework folder.
And useGoogleMobileAds.framework\Versions\A\GoogleMobileAds replace GoogleMobileAds.framework\GoogleMobileAds
I am manually dragging the AdMob SDK into my project and was getting this error. Ultimately what worked was I dragged the SDK files into my projects folder on the computer (for me it was: Users/aaronfrom/documents/projectname) when asked to replace files I said yes. It then worked. I think that this is where my framework search path was directed towares and I needed to update the files in the project folder on my computer, it had nothing to do with settings in Xcode.
Check that you have google_mobile_ads.framework in the Frameworks section in the General tab of your project target settings.
If not add the framework with the '+' button. It works for my case
This worked for me:
#import <GoogleMobileAds/GADInterstitialDelegate.h>

Resources