I installed this library in my project (a command line tool) via Cocoapods, but, even perfectly following all the instructions, Xcode doesn't see the module even if it's in the same workspace of my program
This is my Podfile:
platform :osx, '10.11.5'
use_frameworks!
target 'my_program' do
#no version required, otherwise it throws an error
pod 'Gloss', :git => 'https://github.com/hkellaway/Gloss.git'
end
and, as said, it installs the library without any error and creates a 'my_program.xcworkspace', which is where I should build the program instead of 'my_program.xcodeproj'. The problem is that I can't import the library in the main source file because Xcode thinks that there is no module named 'Gloss' in the workspace (even if there actually is).
What could I do?
Thanks
EDIT
I discovered that command line tools don't support framework. Thanks, Apple.
Anyway, I won't delete the question so that someone having my same struggle can have a quick answer
Did you build after importing Gloss?
xCode gave me an error saying there was 'no such module' until i built the project and it then detected it.
Related
I'm trying to follow the instruction for Linphone, to download the SDK for iOS, either here:
https://wiki.linphone.org/xwiki/wiki/public/view/Lib/Getting%20started/iOS/
or here: https://gitlab.linphone.org/BC/public/linphone-iphone
They both start with this CocoaPods thing, that im not familiar with, and it doesn't seem to work... all I get is this error:
[!] Couldn't determine repo type for URL: 'https://gitlab.linphone.org/BC/public/podspec.git': (<unknown>): mapping values are not allowed in this context at line 3 column 17
Tried on Mac M1, and Intel Mac. Always the same error. I would rather not build the entire SDK, just need to include the SDK in my project.
To include the sdk you need to place a source to their podspec git in the pods file and then you can use it as if it was in cocoapods
Example ios pod file:
source ‘https://gitlab.linphone.org/BC/public/podspec.git’
source ‘https://github.com/CocoaPods/Specs.git’
platform :ios, ‘11.0’target ‘test’ do
project ‘test.xcodeproj’
pod ‘linphone-sdk’, ‘~> 5.0’
end
This is fixed for iOS since some months.
I have forgotten to fix this also for MacOS podspec repo.
This is now also fixed.
The explanation is here : https://github.com/BelledonneCommunications/linphone-sdk/issues/207
TL;DR : It was an issue caused by Gitlab's way to handle files not found (redirection) for Cocoapods-version.yml, confusing Cocoapods.
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.
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...
I'm trying to install a new pod (PXGoogleDirections) to my already existing xcode project which already had a GoogleMaps pod installed.
platform :ios, '8.0'
use_frameworks!
target 'Roadtrip' do
pod 'GoogleMaps'
pod 'PXGoogleDirections'
end
target 'RoadtripTests' do
end
target 'RoadtripUITests' do
end
When I run "pod install" I'm getting the error: "[!] The 'PROJECT' target has frameworks with conflicting names: GoogleMaps."
Any idea how I can fix that?
I've already tried to use the same GoogleMaps version as PXGoogleDirections uses, like so:
pod 'GoogleMaps', '1.10.4'
but I'm getting the same error.
Thanks for your help.
This is because PXGoogleDirections itself is bundled with GoogleMaps. In the documentation of PXGoogleDirections says the way to use googlemaps with it.
Check this
If your app also requires the Google Maps iOS SDK, you might run into
troubles because of conflicts with the bundled Google Maps iOS SDK in
the Cocoapod. If you happen to face these problems, please try to do
the following:
Add -framework "GoogleMaps" to the "Other Linker Flags" of your Xcode
project. Make sure you are linking your app with all the libraries and
frameworks required by the Google Maps iOS SDK. For a full list, see
here:
https://github.com/CocoaPods/Specs/blob/master/Specs/GoogleMaps/1.10.4/GoogleMaps.podspec.json
Also make sure that your app contains the GoogleMaps.bundle in the
"Copy Bundle Resources" phase of the build process. If it doesn't, you
can manually add it to Xcode by browsing to the following directory in
the Finder:
/Pods/PXGoogleDirections/Dependencies/GoogleMaps.framework/Resources/GoogleMaps.bundle.
Drop it in the "Frameworks" group of your project and uncheck the
"Copy" checkbox.
Direct Link https://github.com/poulpix/PXGoogleDirections#in-case-of-problems
I have downloaded Chess.app from opensource.apple.com. When I run xcodebuild install I get an error:
fatal error: 'CoreFoundation/CFLogUtilities.h' file not found
#import <CoreFoundation/CFLogUtilities.h>
^ 1 error generated.
The same error occurs when Building within XCode.
I have looked in /System/Library/Frameworks/CoreFoundation.framework/Versions/A/Headers/ and, sure enough, CFLogUtilities.h is not present. I see that it's available to download from Apple's Open Source Website, but I feel like if it's linked in an app bundled with the OS, it should be installed by default, or at least after installing XCode + Command Line Tools.
Do I have to manually download and bundle the header file in order to build the project, or am I missing something?
I don't know what OS version you are using, but to compile this on 10.9 simply change CFLogUtilities.h to CoreFoundation.h.
you also either need to build the CrashReporterClient.a library and add it to the project, or remove it from the "link with libraries" build setting for the target.
a shell script will fail because iconcompiler is missing, but you can comment out that script line with a # and run just fine. I will leave it as an exercise to you to figure out how best to restore the app icon.