Error when running Firebase in Swift - ios

I am playing around with Firebase and I am trying to print the value of an item in Swift. This is the only code in the whole application, so nothing really complicated is going on.
var myRootRef = Firebase(url:"https://jotty.firebaseio.com/")
override func viewDidLoad() {
super.viewDidLoad()
myRootRef.observeEventType(.Value, withBlock: {
snapshot in
println(snapshot.value)
})
}
When I run this I get an error:
2015-07-15 12:15:03.492 Jotty[32431:733653] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[FRepo youForgotToSetMinusObjCInTheOtherLinkerFlagsInYourXCodeProject]: unrecognized selector sent to instance 0x7b28b7a0'
Would anyone know how to fix this? I have been trying to fix this all day but I have no idea what is wrong with the application.

In "Build Settings" under "Other Linker Flags" use the "-ObjC" flag.
I recommend using CocoaPods instead of a manual setup.
See the Firebase docs for a manual setup.

Related

Firebase database iOS crashing GTMSessionFetcher

I updated firebase and since then my app keeps crashing with the following error
Fetcher delegate class: NRMAURLSessionTaskDelegate Fetcher made an
extra session: GTMSessionFetcher 0x125d53db0 Couldn't assign
delegate.
Fetcher delegate class: NRMAURLSessionTaskDelegate
-[GTMSessionFetcher setFetcher:forTask:]: unrecognized selector sent to instance 0x125d53db0
* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[GTMSessionFetcher
setFetcher:forTask:]: unrecognized selector sent to instance
0x125d53db0'
* First throw call stack: (0x18260ad8c 0x1817c45ec 0x182618098 0x1826105c8 0x1824f641c 0x104637b14 0x104613928 0x10461011c
0x102d9364c 0x102d96bdc 0x102d95140 0x102d92a54 0x102db3f90
0x102db36b0 0x102da0e00 0x105bfd1dc 0x105bfd19c 0x105c0bdfc
0x105c006ac 0x105c0bc20 0x105c006ac 0x105c0cd54 0x105c13e38
0x18222fe70 0x18222fb08) libc++abi.dylib: terminating with uncaught
exception of type NSException
the call that I make and crashes is the following:
let reviewsRef = Database.database().reference()
reviewsRef.child("reviews").queryOrdered(byChild: "timestamp").queryLimited(toLast: count)
I added a debug log and the call is made only once.
It seems the line that the app is crashing is
let ref = Database.database().reference()
Did anything changed regarding configuring Firebase from 4.9 to 5.0 version?
Another update:
It seems to be working on the Xcode simulator but not on device. Device is iPhone 6s with 11.4
Kind of working since on simulator I receive the whole database instead of only the "reviews" that I am requesting
if the rules are:
{
"rules": {
".read": true,
but when I change to:
"rules": {
"reviews": {
".read": true,
I get permission denied(on simulator).It has to do maybe with authentication? I understand that those 2 might be two different issues.
I have no idea why this happened on the first place. But I created a new project in firebase with exact same rules and it worked... for some reason the specific project became corrupt on firebase side.
NRMAURLSessionTaskDelegate indicates usage of New Relic - if it worked on a clean project there might be an incompatibility with Firebase

Firebase iOS SDK - Missing Database URL

Hi I get the following error that I have inherited from a previous developer. My app keeps crashing with the following :
2016-06-21 22:26:16.828 Drnk[3234:1081556] The default app has not been configured yet.
2016-06-21 22:26:16.832 Drnk[3234:1081556] *** Terminating app due to uncaught exception 'MissingDatabaseURL', reason: 'Failed to get FIRDatabase instance: FIRApp object has no databaseURL in its FirebaseOptions object.'
*** First throw call stack:
My App delegate has the following code:
FIRApp.configure()
My controller where I call the database and the app crashes has the following code:
var ref: FIRDatabaseReference!
self.ref = FIRDatabase.database().reference()
I have added the google-services-plist file to my project as instructed.
This all works with another app I am developing but I can't solve this.
Make sure you're not calling FIRDatabase.database().reference() before viewDidLoad
In your class define a var:
var ref: FIRDatabaseReference?
then in viewDidLoad
ref = FIRDatabase.database().reference()
This is how I fixed it here https://stackoverflow.com/a/65866188/4833705
I didn't want to add the same code twice and the comments are kinda long so someone might miss this.
Download and replace the GoogleService-info.plist again since you have already registered the database in your account

ios Chromecast sender: [NSMutableDictionary gck_loadFromCacheWithName:]: unrecognized selector sent to class 0x1133f1678

Im trying to build a chromecast sender app for ios. I am running the HelloVideoGoogleCast successfully. Now mimicking that, I use these lines in my app:
// Chromecast added section:
kReceiverAppID= #"65E5F27B"; // the app code
// Establish filter criteria.
GCKFilterCriteria *filterCriteria = [GCKFilterCriteria
criteriaForAvailableApplicationWithID:kReceiverAppID];
// Initialize device scanner.
self.deviceScanner = [[GCKDeviceScanner alloc] initWithFilterCriteria:filterCriteria];
and I get the following error on the last line:
[NSMutableDictionary gck_loadFromCacheWithName:]: unrecognized selector sent to class 0x1133f1678
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[NSMutableDictionary gck_loadFromCacheWithName:]: unrecognized selector sent to class 0x1133f1678'
You need to add the -ObjC linker flag to your Other Linker Flags entry in the Build Settings part of XCode.
Those categories should then be loaded from the static library once that's in, and you'll be good to go!
As an alternative, consider using Cocoapods to integrate the google-cast-sdk, which will do this for you!

Quckiblox ios SDK crashes on all API calls

I am developing an app using Quckiblox (Swift 2, iOS 9) and all attempts to make an API call produce the following error:
2015-10-04 04:46:06.411 Twister[1964:846268] +[QBRequest signUp:successBlock:errorBlock:]: unrecognized selector sent to class 0x1000f7358
2015-10-04 04:46:06.415 Twister[1964:846268] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[QBRequest signUp:successBlock:errorBlock:]: unrecognized selector sent to class 0x1000f7358'
The SDK was installed with Cocoapods and it's being set up like:
func setup() {
print("Setting up Quickblox...")
QBApplication.sharedApplication().applicationId = UInt(AppConfiguration.Quickblox.ApplicationID.description)!
QBConnection.registerServiceKey(AppConfiguration.Quickblox.AuthorizationKey.description)
QBConnection.registerServiceSecret(AppConfiguration.Quickblox.AuthorizationSecret.description)
QBSettings.setAccountKey(AppConfiguration.Quickblox.AccountKey.description)
}
This is the faulty call:
QBRequest.signUp(user, successBlock: { response, user -> Void in
print("Sign up successfull:\n \(user)")
})
{ response -> Void in
print(response.error)
}
Any ideas on what might be wrong?
Make sure you have opened xcworkspace and NOT xcodeproj.
I have tested your code and everything works, so problem is that Xcode can not find .framework symbols, it finds only headers
May be this is late but it may help someone in future
i have faced same problem and that was solved by
Add -lxml2, -ObjC flags to Other Linker Flags section in project settings
Official doc link
If still error occurs check if any framework is missing

iOS, Error when initializing GMSPlacesClient - unrecognized selector sent to instance

I am trying to integrate Google Maps API's Autocomplete feature on the app.
I am trying to instantiate GMSPlacesClient on the a ViewController's viewDidLoad override, according to the documentation here.
https://developers.google.com/places/ios-api/start
var placesClient: GMSPlacesClient?
override func viewDidLoad() {
placesClient = GMSPlacesClient()
super.viewDidLoad()
}
GMSServices has been instantiated on the AppDelegate using my key.
But I'm getting the following error during instantiation.
2015-10-02 22:04:59.734 food2eat[93509:13849667] -[NSThread gtm_performBlock:]: unrecognized selector sent to instance 0x7ffc03f04f80
2015-10-02 22:04:59.766 food2eat[93509:13849667] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSThread gtm_performBlock:]: unrecognized selector sent to instance 0x7ffc03f04f80'
What am I doing wrong?
Faced the same problem. This error started after I changed the GMS API key.
Oh I figured it out alright! I remembered that It worked for me while not using CocoaPods.
I specifically remember that I needed to add a bunch of frameworks, but the important thing here is that you have to add the -ObjC flag, to the Other Linker Flags in your target's Build Settings.
After doing that it worked for me!

Resources