I'm trying to import Firebase after installing Cocoapods via terminal but i'm getting the following error message:
Could not build Objective-C module 'Firebase
Can someone help me out with this?
This is my Podfile content:
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'Login_test' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for Login_test
pod 'Firebase/Core'
end
Assuming that you have installed FireBase properly via CocoaPods. Try the following steps
Step 1 - Close Xcode
Step 2 - Clear your derived data. You can find your derived data in here
~/Library/Developer/Xcode/DerivedData
Step 3 - Open your .xcworkspace
Step 4 - Clean your project (⌘+Shift+K)
Step 5 - Build your project (⌘+B)
Hope this helps.
for beginners:
make sure you read the message after installing the Pod,
you need to close the xcode project and use the .xcworkspace for this project from now on.
For me the issue was simple. I have a new m1 mac and it has trouble loading cocoa pods sometimes. Simply click your pods project(blue pods)->Click all & build settings ->Excluded architectures -> add "arm64" to both debug and release -> set any SDK on left side -> do this on your main project folder too -> build it your good to go
See Example
Related
I am trying to build a framework in Xcode. Using Cocoapods as dependency manager and adding pod 'Alamofire' to the target.
Here are more details -
This project I have created using Xcode -> File -> New -> Project -> iOS -> Framework & Library -> Framework.
Since the project is having dependencies I am opening the xcworkspace file as per the instruction after running pod install command on terminal.
Added one Aggregate target to the same project under targets section.
Added a new run script from Project -> Targets -> Aggregate target -> Build Phases.
Added the steps to create xcframework instructed by apple to the run script.
Tried building the Aggregate target now.
Finally it is producing errors like - linker command failed or no such module Alamofire etc.
Tried lot many changes and instructions from internet but nothing helped so far.
I am using -
Xcode - 12.5.1
Swift - 5.0.
Macos - 11.5.
Is it a bug of Xcode or any special thing I need to take care during the process or I am doing it completely wrong?
Note - This one is a very simple project for testing out the xcframework build process with pods. Actually we have a project with multiple sub targets as frameworks which we are planning to build as xcframeworks and link with the main project target.
Try add this post install step to your Podfile:
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
end
end
end
And in your xcodebuild archive make sure to have:
SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES
I wanted to implement Firebase SDK in my Swift project. I followed the instructions and installed pods, created a Podfile as follows:
platform :ios, '7.0'
target 'MyApp' do
pod 'Firebase'
project '/Users/MyName/Desktop/MyApp/MyApp.xcodeproj'
end
Then as I do install pods, it comes out with the following in terminal:
Analyzing dependencies
Downloading dependencies
Using Firebase (3.9.0)
Using FirebaseAnalytics (3.5.1)
Using FirebaseCore (3.4.4)
Using FirebaseInstanceID (1.0.8)
Using GoogleInterchangeUtilities (1.2.2)
Using GoogleSymbolUtilities (1.1.2)
Using GoogleToolboxForMac (2.1.0)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 7 total pods installed.
So I thought it worked but after reading various posts online apparently this is supposed to produce a xcworkspace file which I'm supposde to use instead of xcodeproj- is that correct? And if so why hasn't it generated it? I don't understand what is going wrong.
It might also be relevant info that I added all the bits to my xcodeproj file (before realising I should be working with xcworkspace instead) so the pods had come up in my xcodeproj, I added the import Firebase header file, the Google service info, plist and the import+ FIRApp.configure() in delegate and added $(inherited) in other linkers and when I try to use simulator it comes up with an error saying:
Library not found for GoogleToolBoxForMac
Linker command code failed with exit code 1 (use -v to see invocation).
How come it allowed me to do all this if the initial install was incorrect? And where do I go from here?
Can I please get some help about what is going wrong? And how can I solve this problem? Or at least am I able to go back to step one and reverse all these changes smoothly?
If possible please use examples, I am a newbie.
Incase someone else is having this error. The problem was that I was in the wrong directory and had attempted to put a Podfile with the directory leading to 'MyApp.xcodeproj'. This is incorrect as the Podfile should just be in the folder. Initially I was not able to locate this folder (even though it was on my Desktop) so I used in terminal:
cd ~/Desktop
then
cd ~/Desktop/MyApp
and then
pod init
and edited the Podfile followed by
pod install...
I am exporting a project from Unity3d to xcode that uses the last GoogleMobileAds package.
I have installed and updated cocoapods and also have the famous podfile containing de following lines:
source 'https://github.com/CocoaPods/Specs.git'
install! 'cocoapods', :integrate_targets => false
platform :ios, ‘8.0’
target ‘MyProject’ do
pod 'Google-Mobile-Ads-SDK', '~> 7.14’
pod 'Firebase/Core'
pod 'Firebase/AdMob'
end
and I run
pod install
and
pod update
successfully
dependancies are downloaded alright, as you can see the results below:
Updating local specs repositories
CocoaPods 1.2.0.beta.1 is available.
To update use: `sudo gem install cocoapods --pre`
[!] This is a test version we'd love you to try.
For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.2.0.beta.1
Analyzing dependencies
Downloading dependencies
Using Firebase (3.9.0)
Using FirebaseAnalytics (3.5.1)
Using FirebaseCore (3.4.4)
Using FirebaseInstanceID (1.0.8)
Installing Google-Mobile-Ads-SDK (7.14.0)
Using GoogleInterchangeUtilities (1.2.2)
Using GoogleSymbolUtilities (1.1.2)
Using GoogleToolboxForMac (2.1.0)
Generating Pods project
Skipping User Project Integration
Sending stats
Pod installation complete! There are 3 dependencies from the Podfile and 8 total pods installed.
According to both cocoapods and google mobile ads documentation, I will need to continue with "MyProject.xcworkspace" but the file is nowhere to be found.
any suggestions?
When using install! 'cocoapods', :integrate_targets => false Cocoapods will not create an xcworkspace for you.
That's the intended behaviour. You'll even notice this if you follow the command prompt. This line is telling you that no integration is taking place.
Skipping User Project Integration
If you want to get an xcworkspace just remove :integrate_targets => false
It seems the problem comes from editing the Podfile using TextEdit.
As it warns you that you should not continue using TextEdit, one could falsely suppose that the program is intelligent enough to understand and correct these unwanted modifications.
This is the solution I have found:
delete the Podfile and Podfile.lock from your working directory
create a new Podfile using pod init
install SublimeText and use it to open the Podfile
add the necessary pods for the project
(I also included the line "use_frameworks!" although it may not be
needed.)
run "pod install" and "pod update"; this time I get
[!] Please close any current Xcode sessions and use Orbit.xcworkspace for this project from now on.
and the file is now available in project directory
You was used this guide for install pod?
In addition to Radu Dita's message. If you do not want that line to be added (so you do not need to delete it later), you need to disable cocoapods integration in "iOS Resolver Settings" by selecting "None", build project and then enable it back "Xcode Workspace". I found this with try and error. I hope my message will save save someone's time
I am working on a mobile app in Xcode 7.2 using swift 2.1. I installed Alamofire though cocoapods and in my podfile I specified Alamofire version 3.0 as shown below:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
target 'SeniorSeminar' do
pod 'Alamofire', '~>3.0'
end
After installing Alamofire, I opened up my .xcworkspace and tried importing Alamofire into one of my model files. I received the error: "No such module 'Alamofire'". I went and looked in the Podfile.lock and it shows that Alamofire version 4.0 was actually installed. I dont think version 4 is compatible with the versions of xcode and swift I am working in and I would prefer not to update either of these for fear of creating a ton of errors that I dont have time to fix. Does anyone have any suggestions on how to uninstall Alamofire -version 4 and forcing version 3 to install instead? Or are there any work arounds for why my project wont let me import Alamofire?
Delete you pods directory and perform a clean on your project.
Change your podfile pod installation line to
pod 'Alamofire', '3.0'
Install your pods again
Perform a build! - Frameworks won't be imported until you build your project after installing them. Easy to forget.
I Hope you followed All the Steps for Installing ** Alamofire** correctly and have latest version installed
If Not Follow this Step First
Step 1 : Pod init
Step 2 : Open podfile
Step 3 : add this in your podfile pod 'Alamofire'
Step 4 : Pod install
Then Follow This Step:
Step 1 :
Import Alamofire
Step 2 :
Keep on Pressing Build ( Cmd + B)
Step 3:
If Issue Continues then just close your Current program for a moment
by completely closing it (cmd + Q) and then Re-start it and Follow
Step 1 & 2 This will work
Thanks
I am trying to add the Parse.com SDK to my Xcode 7 project. I have followed the getting started guide and I have managed to do it before in Xcode 6.
However this time I am being shown this error message when I try to build:
ld: framework not found Bolts
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Thanks
There seems to be an issue with Xcode 7 beta where the search path for manually added frameworks is missing.
To fix the issue add the search path by doing the following:
Select Project
Click on Targets
Click Build Settings
Search for: Framework Search Path
Add the following without the quotes: "$(PROJECT_DIR)" and choose recursive option.
The project should build now.
I suggest you integrate Parse using CocoaPods.
Cocoapods manages the library dependencies in a much better way.
The following is a sample PodFile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '7.0'
inhibit_all_warnings!
target '**YourProjectName**' do
pod 'Parse', '~> 1.7.1'
pod 'AFNetworking', '2.2.3'
end