Flutter: Firestore transaction crashes only on physical iOS device - ios

I have a simple transaction that updates a Firestore document. It works correctly on Android devices, Android Emulators and iOS emulators, but crashes on a physical iOS device:
Firestore.instance.runTransaction((Transaction tx) async {
DocumentSnapshot docSnapshot = await tx.get(docRef);
tx.update(
docRef,
{
'title':'A Title'
},
);
}
Error:
-[NSError init] called; this results in an invalid NSError instance. It will raise an exception in a future release. Please call
errorWithDomain:code:userInfo: or initWithDomain:code:userInfo:. This
message shown only once.
Assertion failure in void
firebase::firestore::core::Transaction::EnsureCommitNotCalled()(),
/Users/path_to_app/ios/Pods/FirebaseFirestore/Firestore/core/src/firebase/firestore/core/transaction.mm:198
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'FIRESTORE INTERNAL
ASSERTION FAILED: A transaction object cannot be used after its update
callback has been invoked. (expected !committed_)'
I'm not sure what the error means, and my Google quest has hit a dead-end. Really hoping someone can point out what the problem might be!

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

Services cannot be added more than once

Using the following code to re-publish my Bluetooth service, I intermittently get a crash with the error message below.
self.stopAdvertising()
peripheralManager.removeAllServices()
if let service = self.cbService {
NSThread.sleepForTimeInterval(0.1)
peripheralManager.addService(service)
self.startAdvertising()
}
2016-06-03 09:32:10.262 BottleSimulator[180:3587] * Assertion failure in -[CBPeripheralManager addService:], /SourceCache/CoreBluetooth/CoreBluetooth-256/CBPeripheralManager.m:307
2016-06-03 09:32:10.270 BottleSimulator[180:3587] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Services cannot be added more than once'
Why am I getting this? I would think that the call to removeAllServices() would protect against this. I even added a sleep for testing, but it didn't stop the intermittent crashes.
Is there a more reliable way to re-publish a service?

Error only on iOS 9 devices

I can't get my app to run now on certain devices.
int retVal = UIApplicationMain(argc, argv, nil, #"AppController"); <---SIGABRT
In the console I get...
-[BAPushCenter (null selector)]: unrecognized selector sent to instance 0x8a22960
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason:
'-[BAPushCenter (null selector)]: unrecognized selector sent to instance 0x8a22960'
*** First throw call stack:
(0x2502386b 0x369d6dff 0x25029035 0x369f1a4b 0x25028244 0x24f528e5 0x24f56377
0x1cfa1 0x25026b31 0x24f562b8 0x291baa29 0x293cd61d 0x293e0381 0x293ca91f
0x2d18dccd 0x2d18dfb90x24fe6827 0x24fe6417 0x24fe477f 0x24f371e9 0x24f36fdd
0x291a143f 0x2919c18d 0x2a70d3 0x37101873)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
I have no idea what BAPushCenter is, I did a project search and can't find it anywhere. I used an exception breakpoint but it didn't show me any more information then original error.
Update: After testing more devices the error only seems to occur on iOS 9 devices. But iOS 9 simulator devices and any other device below iOS 9 work fine. Any ideas?
In my case, because of the "Batch Framework" my app crashes
Figured it out. The class was coming from one of my static libs so i wasn't able to search it. When I figured out what lib was causing the issues I completely removed it from my app and it compiled fine. Once I get an updated version of that lib I'll put it back in my app, thanks.

Native registration to Azure hub always crashes the first time the app is launched

I've made a iOS 7.0 app that use push-notifications and the Azure Mobile services framework. All is good, but I've seen that when I clear my app (e.g., remove it from my phone to force a "first launch" use-case), the app crashes from what I assume is a bug/crash within the Azure framework?
Basically, I'm running the following code-snippet;
//Proceed and register
SBNotificationHub* hub = [[SBNotificationHub alloc] initWithConnectionString:notificationConnectionString
notificationHubPath:notificationHub];
DDLogInfo(#"Hub object = %#", hub);
//Register with native hub...
NSError* error = nil;
if (![hub registerNativeWithDeviceToken:deviceToken tags:nil error:&error])
{
//False
DDLogInfo(#"Failed to register with native hub...");
if (error)
DDLogError(#"Found error; %#", error.localizedDescription);
}
... and when registerNativeWithDeviceToken: is executed, my app crashes with the following exception;
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** setObjectForKey: key cannot be nil'
Enabling breakpoint exceptions show the following trace, indicating that it's the SBLocalStorage class, part of the Azure framework, that try to put nil in a NSDictionary;
Thread 4, Queue : NSManagedObjectContext Queue
#0 0x3bc7e1f0 in __pthread_kill ()
#9 0x30e6e1be in -[__NSDictionaryM setObject:forKey:] ()
#10 0x0022afa8 in -[SBLocalStorage updateWithRegistrationName:registration:] at /Users/admin/Desktop/Main/enlist/WindowsAzureMessaging/WindowsAzureMessaging/Helpers/SBLocalStorage.m:89
#11 0x0022ae4c in -[SBLocalStorage updateWithRegistration:] at /Users/admin/Desktop/Main/enlist/WindowsAzureMessaging/WindowsAzureMessaging/Helpers/SBLocalStorage.m:70
#12 0x00227d76 in -[SBNotificationHub retrieveAllRegistrationsWithDeviceToken:error:] at /Users/admin/Desktop/Main/enlist/WindowsAzureMessaging/WindowsAzureMessaging/SBNotificationHub.m:700
#13 0x00227202 in -[SBNotificationHub registerNativeWithDeviceToken:tags:error:] at /Users/admin/Desktop/Main/enlist/WindowsAzureMessaging/WindowsAzureMessaging/SBNotificationHub.m:458
#14 0x000b6788 in -[BackendCommunicator registerPushNotificationsForDeviceToken:] at /Users/markus/Xcode/MyApp/myApp/BackendCommunicator.m:1632
But, regardless, has anyone else seen this? And moreover, why does it work all consecutive launches, BUT NOT the first?
Best,
/Markus
I tried to reproduce the issue you described, but for me SDK works OK at this scenario. However I found and fixed serious bug.
Latest version is available on Git Hub, I've also uploaded ready-to-use binaries for your convenience: https://github.com/Azure/azure-notificationhubs/tree/master/iOS/bin.
So I would suggest you to try if it works after last fixes.

Cannot start any Tabris 1.0 application on iOS

Sorry, but I wasn't sure whether to post Tabris questions here or on GitHub, now that 1.0 is available? This is a dup of one I just raised on GitHub...
I've had Tabris 1.0 for a few days now, running ok on browser and Android, but I cannot get the iOS client to start at all. Here is my error in XCode, which is the same whether it is an emulated device or a real iPad:
2013-04-24 09:45:53.616 RapHello[2636:907] * 17 DAY(S) OF TABRIS TRIAL LEFT
2013-04-24 09:45:53.620 RapHello[2636:907] -[AppDelegate clientDidBecomeReady]: unrecognized selector sent to instance 0x1e51fb70
2013-04-24 09:45:53.621 RapHello[2636:907] Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[AppDelegate clientDidBecomeReady]: unrecognized selector sent to instance 0x1e51fb70'
* First throw call stack:
(0x343ae3e7 0x3c238963 0x343b1f31 0x343b0737 0x34308208 0x342ff349 0x34c16b7f 0x361c3d11 0x36215b7d 0x361bdd1f 0x361bd7ad 0x361bd1ef 0x37eb15f7 0x37eb1227 0x343833e7 0x3438338b 0x3438220f 0x342f523d 0x342f50c9 0x3621446d 0x362112b9 0xb7981 0xb7908)
libc++abi.dylib: terminate called throwing an exception
This happens quite early on. I see the TABRIS logo screen on the device, but then this crash and nothing else happens.
Any ideas what I'm doing wrong - obviously something quite basic.
Thanks, John
To fix that problem you need to add the following method to your AppDelegate.m :
- (void)clientDidBecomeReady {
/*
Called when the Tabris client did become ready and will start a new session.
*/
}
We will fix this in our trial download asap.

Resources