Reputation: 1565
When I compile the application I get an error equal to this:
Could not build Objective-C module 'Firebase'
This error appear in import Firebase
of my file swift.
Upvotes: 134
Views: 146059
Reputation: 1233
Build (⌘ + B) worked for me. (It's important to build the framework target, then build the project)
Upvotes: 52
Reputation: 1173
This solution worked for me.
Upvotes: 0
Reputation: 87
This worked for me:
/!\ Open project.xcworkspace instead of your old file
Upvotes: -1
Reputation: 61
I had a same issue with a Flutter project.
You should exclude arm64 for simulator architecture both from project and every pod target
Exclude arm64 from the project
Add this code to Pofile
post_install do |installer|
installer.pods_project.targets.each do |target|
# exclude arm64 for simulator architecture the pod target
target.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
end
end
Upvotes: 1
Reputation: 1372
Just go to Pod target and set arm64 in Excluded Architectures
Upvotes: 1
Reputation: 1188
For me the issue was simple. I have a new m1 mac and it has trouble loading cocoa pods sometimes. Simply:
Upvotes: 9
Reputation: 21
It worked for me, when I opened the white workspace instead of the blue one. You press on the file on your desktop and then press the white file.
Image of what the file looks like:
Upvotes: 2
Reputation: 171
I recently had this problem when using Xcode 12. I found that removing the Valid Architectures build setting (VALID_ARCHS) fixed it.
From the Xcode 12 release notes:
The Build Settings editor no longer includes the Valid Architectures build setting (VALID_ARCHS), and its use is discouraged. Instead, there is a new Excluded Architectures build setting (EXCLUDED_ARCHS). If a project includes VALID_ARCHS, the setting is displayed in the User-Defined section of the Build Settings editor. (15145028)
Upvotes: 5
Reputation: 322
When you build, make sure you are at the root directory in the project navigator.
Upvotes: -1
Reputation: 188
None of above solutions worked for me. I found that the problem was I have three targets in Cocoapods file. And only my main one target has Firebase added. So that when I want to import Firebase to a file that is used in other targets, Xcode gives error and says Module 'Firebase' not found. This is my pods project file. One solution for me is adding Firebase pod to all targets. Or another solution is removing the file from other targets.
def common_pods
pod 'XXX'
end
target 'myMainProject' do
common_pods()
pod 'Firebase/Core'
pod 'Firebase/AdMob'
pod 'Firebase/RemoteConfig'
pod 'Firebase/Crashlytics'
pod 'Firebase/Analytics'
end
target 'myExtention1' do
common_pods()
end
target 'myextension2' do
common_pods()
end
Upvotes: 0
Reputation: 481
Install 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)
Make sure your are opened .xcworkspace file
Upvotes: 15
Reputation: 173
For and Solution was as simple as I didn't open the project from the .xcworkspace after I did pod install :D and I got the same error you got. I mistakenly opened it from the old .xcodeproj file. that was it for me, LOL
Upvotes: 0
Reputation: 402
It happened to me because I installed the Firebase CocoaPods but I didn't reopen it through the <projectName>.xcworkspace
file.
So what I did to work was:
<projectName>.xcworkspace
file of the projectUpvotes: 4
Reputation: 16820
I had disabled Find Implicit Dependencies for faster build process under Edit Scheme... > Build
.
Enabling it back resolved the issue.
Upvotes: 4
Reputation: 79
After 2 days of searching and trying every single step proposed in this post, eventually i could solve the problem. None of the above approaches solved my problem but this one:
Simply and Easily the error is gone!
Upvotes: 0
Reputation: 933
Make sure you are working with the workspace file created in the same directory as the pod file.
Upvotes: 2
Reputation: 2101
This worked for me:
Upvotes: 4
Reputation: 339
I opened the project with .xcodeproj and I installed Firebase with cocoapods. I got the same error. But I just close the project and open it with .xcworkspace.
The alert has gone. Firebase was the first library on my project. So I kept using .xcodeproj file.
Upvotes: 20
Reputation: 449
I am using Swift 4 and Xcode 9. All I have to do is selecting FirebaseCore Scheme.
On Xcode:
Product->Scheme->FirebaseCore.
If you don't have FirebaseCore go to Manage Schemes
and select it. Then try again.
Upvotes: 44
Reputation: 41
Tried the above suggestions, but they didn't work for me. What worked for me was to build to Generic iOS Device
first and then run it on my physical device iPhone6.
I still couldn't run it on a simulator, however. What worked here was to change Build Active Architecture Only - Debug
to NO
, in the Pod Project Build Settings
.
Hope this helps someone.
Upvotes: 4
Reputation: 3404
This may fix your problem:
Quit the Xcode. (Don't just close the Xcode window, right click and Quit it explicitly).
Go to ~/Library/Developer/Xcode/DerivedData
and delete the project folder. (Simply delete all the folders).
Clean and Build the project.
If still error exist:
Do steps 1 and 2 and follow this steps:
Change scheme to Firebase and Build (Command + B).
Change back to your app scheme and Run again.
Upvotes: 34
Reputation: 7575
Nothing here worked for me, but then I figured out something that did work.
When I clicked on my project in Project Navigator in Xcode, and then selected Info I looked at the Configurations section and saw that there was only a Release configuration and no Debug configuration for my app.
In order to get Firebase to work, I went to Pods within the Project Navigator, and under the Configurations section I deleted the Debug configuration. Now it builds fine. Hopefully this will help someone else.
Upvotes: 0
Reputation: 99
'pod deintegrate' and then 'pod install' worked for me.
Upvotes: 7
Reputation: 11
This happened to me today, I just couldn't figure out why, because when I closed the file that night, everything was perfect. I opened my file using the recent projects menu and got this issue. Then I decided to check something, Xcode opened the wrong file. Instead of opening the workspace file with the pods, it opened the Xcode project.
Once I opened the workspace it was error free and all the pods were behaving. Im sure you guys are all more experienced than me, but I just wanted to throw that in there.
Upvotes: -1
Reputation: 41
I am using Swift 4 and Xcode 9.4. This helped solve the same issue for me.
I selected the following frameworks in XCode -> Manage Schemes besides my target project
In Xcode:
Product-> Scheme-> FirebaseCore
Product -> Scheme -> nanopb
Product -> Scheme -> GoogleToolBoxforMac
Upvotes: 4
Reputation: 361
I tried this (quitting Xcode, deleting all temp files, reinstalling pods, etc.) and it didn't work. What did work was just building my project (command + b
) after pod install
. Whatever works!
Upvotes: 3
Reputation: 2650
Can you please try to take a look at my answer here
TL;DR make sure you are running cocoapods version 1.4.0 minimum
. It fixes static framework imports.
You can do this by running sudo gem install cocoapods
on your terminal and verify your version by typing pod --version
Upvotes: 3
Reputation: 4530
There is only one way to solve this issue.
~/Library/Developer/Xcode/DerivedData
ProjectName.xcworkspace
Podfile.lock
file and Pods
folderpod install
.ProjectName.xcworkspace
file and build.Upvotes: 269
Reputation: 1
I had the exact same issue
You could be reinstalling pods with your Xcode open Or your pods file won't allow and overwrite
With your workspace open, delete the "Pods" folder. Quit X-Code Open terminal in "Utilities" You'll find this in "Applications" Using cd ... go to your project folder reinstall pods using "pod install".
That should fix it.
Upvotes: -2