Upgraded Firebase - Now Getting Swift Compile Error - ios

I upgraded Firebase yesterday and now am having a very unusual problem. When I run the simulator, I get a swift compile error "Segmentation fault: 11" The are hundreds of lines of code describing the error, but they are absolutely no help. From the error, the only thing I see that might be giving clues is at the bottom. It says:
1. While loading members for 'ProfileTableViewController' at <invalid loc>
2. While deserializing decl #101 (PATTERN_BINDING_DECL)
3. While deserializing decl #2 (VAR_DECL)
Oddly, the errors I just typed above are not consistent. The view controller mentioned rotates between the three view controllers where I am using Firebase.
To try to solve the problem, I commented out all of the code in the ProfileTableViewController class, but I still got an error referencing that view controller. The only code running in the view controller was:
import UIKit
import Firebase
import FirebaseDatabase
(I'm also using FirebaseAuth in other view controllers).
What does work to fix the problem is to hit "clean", restart xcode, clean again on launch and then run the program. Everything will work fine unless I make any changes to the code in the program. Even if all I do is add a comment, the error will reappear.
I don't want to have to close xcode and restart every time I write a couple lines of code, and I am worried that I will run into problems when uploading to the app store.
I am using XCode 7.3.1 and my deployment target is 9.3
Any insight you can give is greatly appreciated! Thank you!

I was able to figure it out! My Cocoa Pods were not up to date. As soon as I went back and installed the latest Cocoa Pods in the terminal, then updated the podfile for this app, this error disappeared.
Process:
Open terminal
sudo gem install cocoapods
(Cocoapods update) In terminal navigate to app folder, then:
open -a xcode podfile
If needed, make changes in podfile. I didn't need to make any changes. Save and exit.
In terminal
pod update
Open the .xcworkspace file and ta da!

I was also pulling my hair out with this issue for some time.
I tried Eric Duffett's answer but without luck.
I figured out it was an issue with the FirebaseAuth. What I did was this:
Remove FirebaseAuth from Podfile
Update pods with pod update
Download Firebase frameworks from their site (at the bottom)
Follow README file to import FirebaseAuth manually in the project (need to import FirebaseAuth.framework and GoogleNetworkingUtilities.framework)
Clean - Build and no more segmentation fault 11 error
Hope this will help someone.

This is/was really driving me berserk.
This code causes the aforementioned crash:
func ref() -> FIRStorageReference {
return FIRStorage.storage().reference()
}
If I just use it in a function everything works:
FIRStorage.storage().reference().dataWithMaxSize(...
Took hours to figure this out. The error message points to somewhere else. This was probably the most frustrating debugging experience in my entire career.

In your podfile you can try to uncomment use_frameworks!
use_frameworks!
pod 'Firebase'
pod 'Firebase/Database'
pod 'Firebase/Auth'
Then run 'pod update' in the terminal. Restart your Xcode project.
This did it for me after struggling for two days with the Segmentation fault 11

Deleting DerivedData and ModuleCache, then Clean>Build worked for me.

I also had this problem with Firebase.
Xcode would complain on particular class. Just like your "ProfileTableViewController"
What I did to solve this was:
Comment all Firebase related imports in that class -> Clean -> Build (Obviously got some errors) -> Uncomment -> Clean -> Build succeeded

I figured out a different solution that worked for me. I had a few custom functions that returned Firebase-specific variables like FIRUser to files that didn't have import Firebase or import FirebaseAuth at the top. I like keeping my data service methods in a separate file, so I just changed the functions so that they returned Strings, such as FIRUser.uid, instead. This FINALLY got rid of the compiler warnings/crashes for good.

The problem for me occurred when I was explicitly setting the types of the completion block parameters for setValue.
FIRDatabase.database().reference(withPath: "test").childByAutoId().setValue("test1") { (error: Error?, ref: FIRDatabaseReference) in }
Everything works fine when the types for error and ref are removed.

Related

Cannot load module 'Snapkit' as 'Snapkit'

I've tried every way of installing 'Snapkit' but so far I'm not having much luck.
I'm using the following:-
Xcode 8.3.3
So far I've tried following all the documentation online to solve the issue, however it still isn't working. Including following the steps here.
The current error message is "Cannot load module 'Snapkit' as 'Snapkit".
Although previously the message was no such module 'Snapkit'.
Typo in case - SnapKit, not Snapkit.
import SnapKit
I had the same error recently. That's why I saw your question. I rebuilt and ran the app. After the build is finished it now recognizes SnapKit )). If you opened it through workspace and if the contents of the pod file are ok, then it should open. Try building the project and type SnapKit after it.
Please ensure if you're using Cocoapods as your dependency manager that you're loading the Xcode WorkSpace and not the project file. Otherwise try cleaning the project and rebuilding.

How to solve 'duplicate symbols for architecture arm64' error?

When I try running my Xcode Project it fails with an error stating that I have duplicate symbols. Below is the way I sovled this error. Hope to help you~
The error info:
From the error info I found that WPBuySkinAlertView maybe the duplicate class.So I seach the file in the project.
There are two WPBuySkinAlertView files in the project.
So, next time when you come with this error, check your project according to the error info, find the duplicate classes and remove the one.
Select Proiect ===> Target ===> Build phase ==> Compile source search WPBuySkinAlertView this name you will see 2 file in search result remove one from them
If this error occurred right after installing a new pod, run pod update. I suspect that the new pod I installed actually installed some of the same dependencies as a previous pod, so there was a duplicate. pod update fixed it for me.
As I found out, multiple causes can lead to this error. I had 2 files containing #main and that is non logical.
In the docs it says:
Apply this attribute to a structure, class, or enumeration declaration
to indicate that it contains the top-level entry point for program
flow.
This was my mistake:
File1.swift
import SwiftUI
#main
...
File2.swift
import SwiftUI
#main
...
In my case I had an issue with one of my pods (cocoa pods) and needed to comment it out, re-run it without it and everything seemed fine. I had recently changed the revision for SDWebImage in my Podfile.

Unable to Import Frameworks/Pods into xcode

I have an issue with xcode where if I try to insert a pod or framework into my project it doesn't see to link. For instance, I added the CoreLocation framework as well as the Firebase/Core pods. In both instances when I go to add:
Import Firebase
Import CoreLocation
the suggestions which appear do not find the desired Framework/Pod to import in my app delegate which leads me to believe there is some sort of linking error. I am further convinced of this because when I try to type things in such as CLLocation Manager and try to run them I get a "build failed" error with the debugger stating "use of unresolved identifier x".
I'm new to stack overflow so hopefully this question isn't too wordy or too general please let me know if any further information is needed.
first, check the pod version and update to the latest version. Then, try building the project multiple times, if nothing happened, remove pod 'Firebase/Core' and do pod install then re-add this line again and do pod install again.
One of the things I've noticed above is that you're not using single quotation marks around the framework name in the podfile.

Are there different ways to include Objective-C pods in swift xcode xcworkspace projects post pod install?

Using pod dependencies, the import behavior is inconsistent.
This behavior is different on different machines for the same pods in Podfile. After successfully installing pods, my team came across the following two situations.
On one it worked through the #import statement in the bridging-header.h file but throws
No such module '<moduleName>' error in the ViewController.swift file when tried that way.
While on another mac it threw errors in the bridging.h file and worked through import <moduleName> in the ViewController.swift file.
Both machines have Xcode 8.1, using Swift 3 syntax and cocoapods version is 1.1.1. We were able to re-create the issue multiple times.
Does anyone know why this happens and if there is some project setting which can be used to produce consistent reults?
We have experienced this behaviour also. We could sometimes 'solve' it via: product>clean.
Sometimes we even had to quit+restart xcode and run clean again.
We agree, it is strange behaviour, probably xcode is losing state information or something.

Cannot load underlying module for 'Charts'

I'm just getting started with the iOS charts library :
I followed all the steps described under 'Usage' on the main page (https://github.com/danielgindi/ios-charts):
I added a UIView and made it subclass LineChartView
--> in ViewController.swift: the line import Charts gives an error: Cannot load underlying module for 'Charts'
Why is that ?
Thank you !
It's possibly related to this issue too: https://github.com/Alamofire/Alamofire/issues/122
In short: Seems like there's a bug in Xcode 6.3.1, where new projects have problems when importing Embedded Frameworks. In such a case, you need to let the project build first, and then add the framework to the project.
Sounds like your project haven't added the framework successfully. I just started with ios-charts as well, and I followed the steps on github as well and it worked like a charm. What I did was to just drag the Charts.xcodeproj into my Project Navigator and it worked like a charm. If this doesn't work for you, however, make sure you are using iOS 8. If you are not, then you have to add the .swift-files to your project. If you are using iOS 8 and the approach still doesn't work, I'd try to install it using CocoaPods instead. I'm fairly new in CocoaPods so can't really help you there, but just google on how to install frameworks using CocoaPods and you should find what you seek.
Sorry if I wasn't of much help!
The answer comes a bit late, but what solved the problem for me was to clean my project by selecting the option Product > Clean from my status bar. Hope it might help someone else in case you solved the problem already.
After cleaning the product once I received this error. I then removed the framework from embedded binaries, cleaned the product, then added it once more to embedded libraries. I then built the product and retried the import statement. The import statement worked.
I had the same issue with KeychainAccess pod. Even though the pod was installed it use to throw an error
‘Cannot load underlying module for KeychainAccess’.
The fix that worked for me :
Uninstall the pod and install it again
Delete the derived data content
Quit Xcode and start again
Make sure your scheme is targeting an iOS device or simulator. If you build for your Mac it'll give you this error.
Build the project and this error will go away

Resources