firebase runTransactionBlock
Thanks to the comments seen above I was able to get this to work
....runTransactionBlock { (currentData: FIRMutableData) -> FIRTransactionResult in
var value = currentData.value as? Int
if value == nil {
value = 0
}
currentData.value = value! + 1
return FIRTransactionResult.successWithValue(currentData)
}
How to track offline transactions for Firebase iOS in Swift 4
There are no callbacks or delegates for transactions that are wiped when the user goes offline. If you want your app to handle offline situations gracefully, you should not rely on transactions in your code.
Firebase Notifications and Firebase Database features do not work at the same time in my app
Yes you can use both. It's documented pretty well on how to setup FIRDatabase: https://firebase.google.com/docs/database/ios/start
I've just built an app with both Messages and Notifications. Use CocaPods to manage and install all your dependancies.
Using transactions in Firebase
Transactions only run within the context of the database where the transaction is started. The all-or-none behavior of transactions only applies to the work that you do within the database itself, not any external properties. Your transaction handlers should be as fast as possible and not block on other work.
The usual practice for file uploads is to perform the file upload first, then after that succeeds, write to the database.
Related Topics
How to Loop Over Struct Properties in Swift
Undefined Symbols for Architecture Armv7 When Using Zxing Library in Xcode 4.5
Uitableview Add Cell Animation
No Round Rect Button in Xcode 5
Open Settings App from Another App Programmatically in Iphone
Xcode Instruments Allocations: Look at Live Bytes or Overall Bytes
Warning: Attempt to Present Viewcontroller Whose View Is Not in the Window Hierarchy
Scnbox Different Colour or Texture on Each Face
How to Track User Location in Background
Custom Pin Image in Annotationview in iOS
How to Get the Custom Overlay for Uiimagepicker Camera to Be Full Screen in iOS 7
How to Get iOS Appstorereceipturl into Base 64 Encoded String
iOS Floating Video Window Like Youtube App
Using Global Variables in Objective-C
What Does Warning "Mapping Architecture Arm64 to X86_64" Mean