xcode error when compiling build failed - ios

I'm doing an app using firebase, I've already done the set up with pod and today when I re-opened the project after a bit of time I have this problem in the picture, any help on how to fix it?
I've already tried to clean and deleting pod files and re-executing a "pod install" but it seems he can no longer see my "import Firebase"

Unfortunately there could be a number of reasons for your error. Here are a couple easily overlooked steps when installing Firebase with cocoapods:
The top of your pod file likely looks similar to the snippet below. It appears you're using swift so make sure you uncomment the "use_frameworks!" line as I've done here :
# Uncomment this line to define a global platform for your project
# platform :ios, '10.0'
# Uncomment this line if you're using Swift
use_frameworks!
Make sure from now on you open your project from the terminal:
$ open your-project.xcworkspace
If you still don't have any luck it may be worth carefully reviewing the getting started guide for Firebase: Add Firebase to your iOS Project

Related

Firebase iOS stuck at 'Run your app to verify installation'

React Native Firebase installation for iOS gets held up at the "Run your app to verify installation" screen.
React Native Firebase has worked on Android for me before.
I followed these instructions.
https://rnfirebase.io/docs/v5.x.x/installation/ios
https://firebase.google.com/docs/ios/setup#add_the_sdk
Here are what I've done so far.
-Set up a project within Firebase.google.com page.
-Create an iOS app there.
-Install react-native-firebase via npm.
-Add GoogleService-Info.plist file to the project within XCode.
-Make changes to ios/[YOUR APP NAME]/AppDelegate.m file.
-Creat a new Podfile (Cocoa pod) and updated it by "pod update" command.
-Add and edited lines to the Podfile per the instruction.
-Run "pod install"
-Run "react-native link react-native-firebase" from the project root.
-Click "Next" button within Firebase console and move on to "Run your app to verify installation" section.
-Run the iOS app on simulator by running "react-native run-ios" command.
The app boots up and functions as normal in the simulator.
Nothing happens in the Firebase page.
This is the first couple of lines of my Podfile.
# Uncomment the next line to define a global platform for your
project
platform :ios, '9.0'
# Required by RNFirebase
pod 'Firebase/Core', '~> 5.20.1'
target 'My_App_Name' do
https://dev-yakuza.github.io/en/react-native/react-native-firebase-admob/
Check this guy's blog. In his particular case, he is integrating Firebase and Admob, but the first part is really descriptive on how to install and set the RNFirebase package.
I found the partial answer to this thanks to #Mike Hardy in the other thread here:
Error message - RNFirebase core module was not found natively on iOS
For the most part, you can trust the official instruction on this page.
https://rnfirebase.io/docs/v5.x.x/installation/initial-setup 
However. There are a few things that are not articulated there you’d need to follow in order to install React Native Firebase on iOS.
I followed the below steps and I managed to get it through the infinite “Verify installation” loop.
-1) Comment out the following lines from your Podfile. You might see the same line in two locations. Comment out all of them.
use_frameworks!
-2) Also comment out a couple of lines just BEFORE the very last end in your Podfile. Once you’ve done this, you will only see one instance of end at the last line.
target ‘YourProjectName-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
-3) Insert the following line just before the final end.
system("mkdir -p Pods/Headers/Public/FirebaseCore && cp Pods/FirebaseCore/Firebase/Core/Public/* Pods/Headers/Public/FirebaseCore/")
-4) And then, run pod install and pod update from your terminal.
-5) Go to Xcode, Check the Build Phases/ Link Binary with Libraries section. Confirm that libRNFirebase.a is already there.
-6) Go to Xcode, select a device of your choice and hit “Run”*
*If you use the command from terminal, it will no longer open your app in the simulator. I don’t know why. But it looks as if once React Native Firebase is installed, the only way to test your app is through the Xcode.
react-native run-ios
**Please note I’ve only verified it with the ‘Firebase/Core’ pod. When I tried to add ‘Analytics’ or ‘AdMob’ module in the Podfile, it crashed.
The problem for me was that my GoogleService-Info.plist was actually from a different firebase project, so it had the wrong project id, bundle id, etc.
FOR REACT NATIVE
So I had the same problem and silly me I put the GoogleService-Info.plist file in the wrong place...
It needs to go directly in the /ios folder!
You need to include necessary modules in your Podfile.
Here is my Podfile
pod 'Firebase/Core', '~> 6.3.0'
pod 'Firebase/Messaging', '~> 6.3.0'
pod 'Firebase/AdMob', '~> 6.3.0'
Note that I had to manually change framework path of GoogleMobileAds with XCode to value $(SRCROOT)/../../../ios/Pods/Google-Mobile-Ads-SDK/Frameworks/GoogleMobileAdsFramework-Current in RNFirebase.xcodeproj file in Librairie > Build Settings > Framework Search Paths
I don't know if this works for you but this is what I did.
I backed up my files. created a new project.
Ran pod init and pod install on a fresh project with no code.
After this I closed Xcode and ran $ sudo gem install cocoapods --pre in the same terminal window.
Finally in terminal that I ran pod install and pod update again.
At this point I reopened my fresh project and reconnected my files.Worked like a gem.
I fought with this for probably 12 hours on my new Mac Book Pro.
You probably do not have the latest version of Firebase in your Pods.
Open your Pod file and add this before the "end" statement:
pod 'Firebase/Analytics'
pod 'Firebase/Auth'
pod 'Firebase/Firestore'
Go to Terminal and cd to your root folder of the Xcode project.
Now, type "pod install" and hit enter. This should update your Firebase SDK and build the latest version of Firebase when you build your app.
Note: You should also delete your app on Simulator and re-install it for the changes to take effect.

Xcode 10 build fails with 'Command CompileSwift failed with a nonzero exit code

I updated Xcode to version 10 recently and started to receive a strange error when trying to build my project. I'm currently on Swift 4.0 and I did try to upgrade to swift Version 4.2. But when I did I received this same error in many of my frameworks.
Command Compile Swift failed with a nonzero exit code
So far I've deleted the derived folder. Updated all pods, also deleted all pods and reinstalled them using the terminal commands below.
sudo gem install cocoapods-deintegrate cocoapods-clean
pod deintegrate
pod clean
pod install
This didn't work to fix my issue. However, I found something that could work which was adding arm64 architecture in Build Setting -> valid architectures and enabling automatic code But, when I checked it was already there and code signing was enabled already.
Additionally, I do have a few other build errors that have to do with frameworks.
SwiftMessages
Value of type 'SwiftMessages.Config' has no member 'presentationContext'
WhatsNewKit
Missing argument for parameter 'backgroundColor' in call`
I opened issues with the developers of each of these frameworks to seek help with these issues.
Issue On SwiftMessage GitHub
Issue On WhatsNewKit GitHub
When I click presentationContext it brings me to the struct within the SwiftMessages Framework. Usually, when I've had the "has no member" warning I cannot click to see the original place where it exists.
I assume this has something to do with cocoa pods, but haven't been able to find a solution yet. What can I do to correct this issue? If anyone could help would be deeply appreciated been stuck on this for a day now.
Update:
The two frameworks latest builds were for swift 4.2. When I changed the version of each framework to one that was built in swift 4.0 I got the project to build.
Make sure that, your project Swift Language Version is in the proper version. SwiftMessages 6.0.0 works with Swift 4.2.
I solved this way:
Comment all pods in your .pod file
From your terminal, run the command pod install --no-repo-update
Open Xcode perform a clean and rebuild the project
Now open your .pod file and uncomment the first library
From your terminal, run the command pod install
Repeat steps 2 - 3 - 4 -5 for each uncomment library in your .pod file
I hope it can be of your help.
Make sure that, Your project build settings Optimization Level is in No Optimization[-Onone].
for pod SwiftMessages if your app is not swift 4.2 you need to user the version 5.01
pod 'SwiftMessages', '~> 5.0.1'
and it will work like a charm
Set Swift version to 4.2 then pod deintegrate, pod install, fix this problem for me. Thanks #alejandro-iván
Good Morning!
Do a clean. using"commond + shift + k
Close Xcode.
Navigate to project directory where the Podfile exist.
Do pod update/pod install
Open x.xcworkspace
This error happened to me when I used same class name in two different groups. Then I renamed one of the classes and the problem was solved
All of the answers were helpful to me. In my case, I only install frameworks manually but this kind of problem also happens. I tried all of the answers and was still getting this issue during the build. Curiously, while coding, I could cmd-click and resolve all of the "missing" components. I also cleaned and deleted derived data, restarted Xcode, etc.
I eventually got it working by inducing these additional steps:
On each of the framework project/targets (including my own):
Verify consistent Swift version (4.2 in my case)
Set Build for Active Architecture Only to No
Set Valid Architecture to arm64, armv7 (to match with base project)
Set Optimization Level to None (for Debug)
Set Compilation Mode to Whole
I had several frameworks (homegrown) plus my app. Somehow they ended up being out of sync as far as the Swift version. Make sure that all frameworks are the same version. In my case, they all needed to be set to Swift 4.2. If you haven't done the migration to 4.2 then remember that Xcode helps with this: Edit -> Convert -> To Current Swift Syntax.
only for re-install pod using that command pod install
see below attachment
In my case I connect an actual iphone not simulator and run the app once on it, It solved the problem. But connect iphone firstly, then choose it from this menu, then press run button.
The problem will solve too.
I stumbled upon this problem when upgrading to Xcode 10.2 and Swift 5. After trying everything I found this in the release notes:
The Swift compiler may crash during a build when the Thread Sanitizer
is enabled. (48719789)
And sure enough, efter turning off Thread Sanitizer my project could be compiled without errors again.
So if you get this error and have Thread Sanitizer enabled - turn it off!
Same issue happened to me in Xcode 10.2, it was a Xcode bug..!
So, I opened in older Xcode version(9.4), and it worked fine. Then I updated to the Xcode 10.2.1 after it's release -> Clean and build your project, now my problem solved.
I'm having the same problem, my Xcode version is 10.2.1 (10E1001),
Cocoapods version is 1.7.0.beta.2.
I returned to Cocoapods 1.6.1 and the problem was solved.
The specific steps are:
pod deintegrate to cancel the integration.
Uninstall all Cocoapods.
for i in $( gem list --local --no-version | grep cocoapods );
do
gem uninstall $i;
done
Install the stable version of Cocoapods. For now it's 1.6.1.
gem install cocoapods
Clean Project and empty DerivedData⁩
pod install
Recompile the project
In my case it was a code error:
self.myDto.map{ (dto)} in
var stringValue = (dto.value(forKey: "name") as! String)
stringValue.append("c")
return stringValue
}
Just removed that stringValue variable fixed the problem.
I just had the same error message and none of the answers here and in the duplicates of this question were applicable to my project or helpful.
I kept on reading through the error messages and came to a realisation that I had stupidly named two seperate swift files in different folders with the same name intending to change one, but before I got to change one, I tried to run my project and have been annoyed for the last hour.
Bottom line, don't accidentally name your files the same name and read your error codes thoroughly!
target 'XYZ' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for xyz
pod 'SwiftyJSON'
pod 'Localize-Swift'
pod 'Alamofire'
pod 'Kingfisher'
pod 'Tabman'
pod 'RSSelectionMenu'
pod 'Pushbots'
pod 'ACProgressHUD-Swift', '~> 1.4'
pod 'SKPhotoBrowser'
pod 'ZoomableImageSlider'
pod 'RSSelectionMenu'
pod 'DropDown'
pod 'ImagePicker'
end
I updated platform :ios, '10.0' to 11.0 and the error disappeared. Change your platform or OS version and check. Hope that could help.
Specify your pod's version for example pod 'RealmSwift', '~> 5.3.5'
or uncomment # platform :ios, '9.0' in your Podfile
I faced this issue on Xcode 14. Add this on podfile bottom.
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
# some older pods don't support some architectures, anything over iOS 11 resolves that
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
end
end
end

Parse SDK / CocoaPods

I have an objective C iOS app using the Parse SDK.
In the process of moving this app from Parse.com to a self hosted Parse-Server, I need to update the Parse SDK to the latest version. For this update I decided to go with CocoaPods.
This is the first time I touch CocoaPods (after reading and hearing so much good about it).
I found my way, following what I could read here and also based on a few CocoaPods tutorial I quickly viewed.
Having my project "ready", when buiding it I get this error:
#import <ParseUI/ParseUI.h> -----> File not found.
Obviously things have changed place. And I tried a couple of unsuccessful solutions.
So here is my question:
How do I need to change the settings of my project, now that I am using CocoaPods?
In order to use Cocoapods with parse and Parse UI you need to do the following steps:
Create a new file and name it Podfile. This file should be located on your IOS project root folder.
The Podfile should contain at least the following structure if you want to use parse IOS SDK and ParseUI
platform :ios, '8.0'
use_frameworks!
pod 'Parse'
pod 'ParseUI'
# Put more pods in here..
Notice to the platform, you may change it to the minimum version that your app can run on and the use_frameworks! will install all your pod as frameworks and this is mandatory if you like to consume Swift libraries.
Open terminal and navigate to your IOS root directory and enter pod install. This command will install all the pods and dependencies into your project.
After installing you will no longer use the IOS project file from now on you will use a new file which called workspace. The workspace will contain both your project files and the pods project/frameworks files.
Build your project, fix some error (if there are) and run it to make sure that it works as expected .
More CocoaPods commands that you need to know are:
pod update - update all your pods to the latest release or to the release that was mentioned in the Podfile
pod update update specific pod to the latest release or to the release that was mentioned in the Podfile
pod outdated - display out to date pods that are being used inside your project.

Installation error in Cocoapods

I am trying to install cocoapods for my project. And i followed these steps
But its showing 0 dependencies in podfile. Can anyone tell me what should i do??? And also guide me how to install Google API for my project in order to show list of places in a tableview.
UPDATED QUESTION
I have also tried the following steps but still it is not working-
Seriously am going crazy right now.Unable to find the mistake. And idea where am i going wrong???
1.Edit the Podfile and add the following lines.
source 'https://github.com/CocoaPods/Specs.git'
pod 'GoogleMaps'
2.Save the Podfile.
3.and then locate your project path and use command
pod install
follow the link for reference
https://developers.google.com/maps/documentation/ios-sdk/start
if you are opened the any Xcode Project you must close all Xcode project that is already open and then try the Pod Install command , surely works
Update
after this command pod init Type this command to open the Podfile using Xcode for editing:
open -a Xcode Podfile
then you need to add the pod 'GoogleMaps' or whatever you need , see the attached image for reference
for step to integration see this

Using CocoaPods for the "Charts" framework. Swift 2

I am a newbie when it comes to CocoaPods so please bear with me!
I am looking at the tutorial (https://www.raywenderlich.com/97014/use-cocoapods-with-swift) however this is using the dependency "pod 'Alamofire', '2.0.2'". I have looked online for over a hour now and I can't find what to use for the Charts framework (https://cocoapods.org/?q=charts).
So Far i have done the following steps:
1.
sudo gem install cocoapods
and got the following output:
2.
pod setup --verbose
and got the following output:
3.
open -a Xcode Podfile
and got the following result :
4.
Uncommented "use_frameworks!" and uncommented "platform :ios, '6.0'" and changed it to "platform :ios, '9.0'"
Now i am stuck as i don't know what dependancies i need to use for the charts framework. Apologies if this is a very simple answer!
Thanks in advanced for your help :)
EDIT: After installing the pod files i dragged the 'Charts.xcodeproj file into my project.
When i try and embed binaries i have various options:
When i add them and build i get the following errors:
Hey First you have to decide which chart library You want to use.
Something like this https://github.com/danielgindi/ios-charts
for above chart library you have to use
pod 'Charts'
in your pod file inside the project .
Now your pod file will be something like this
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'Charts'
Now open the terminal and go to your project directory and enter the command
pod install
and you are good to go.
Hope this help you.
Usually there are instructions on what CocoaPod name to use for installation on the GitHub or source code hosting page of the library.
After a pod install command under your correct project directory, you need to exit out of your .xcodeproject and open up the workspace file. This is what you do from now on after a project has a cocoapod dependency. The workspace now contains both your project, and the pods project as a package manager. The pod(s) you installed are there, and must be accessed by importing the name of the CocoaPod (can be seen in folder drop down view in the Pods project).
You do not need to drag anymore files in your own project or embed like before. Make sure to delete those.
If you're still having trouble, can you edit what your current podfile looks like?

Resources