I have an int userCoin
that holds the user coin and I want to equal Firebase' value to my int value.
I have this code
self.databaseRef = [[FIRDatabase database] reference];
NSString *userID = [FIRAuth auth].currentUser.uid;
[[[_databaseRef child:@"users"] child:userID] observeSingleEventOfType:FIRDataEventTypeValue withBlock:^(FIRDataSnapshot * _Nonnull snapshot) {
// Get user value
NSLog(@"%@",snapshot.value[@"Profile Picture"]);
userCOin = snapshot.value[@"Coin".init];
} withCancelBlock:^(NSError * _Nonnull error) {
NSLog(@"%@", error.localizedDescription);
}];
but it wont work. It says:
ViewController.m:45:18: Incompatible pointer to integer conversion assigning to 'int' from 'id _Nullable'