iOS Question Objective-C Inline code for firebase realtime database

jkhazraji

Active Member
Licensed User
I did not find support for Firebase realtime database in b4i ( a library):
Is there an OBJC inline code to do that?
I tried the following code (taken from FIrebase docs) in a b4i Firebase project (which worked for Firebase notifications and authentications )but without benefit since it generates a compile error:
B4X:
#If OBJC

   @import Firebase;
   // Use Firebase library to configure APIs
  -(void) write : (bool) on { 
   [FIRApp configure];
   @property (strong, nonatomic) FIRDatabaseReference *ref;
   self.ref = [[FIRDatabase database] reference];

   [[[self.ref child:@"users"] child:authResult.user.uid]
    setValue:@{@"username": username}];
     NSLog(@"written");
}


#End If
 
Last edited:

jkhazraji

Active Member
Licensed User
Hard to believe. Looks like you simply combine fragments.
You need to find a sample, for example, on Stackoverflow.
Sorry I am only a newbie, I did not find any on Stackoverflow! I will be grateful for one
Edit : The difficulty, even if I found one , is really to adapt the code to the inline Objective-C inside the b4i IDE.
 
Last edited:
Upvote 0

Semen Matusovskiy

Well-Known Member
Licensed User
If you need to call some functions only (like in fragment, which you posted), you can avoid OBJC at all (using NativeObject).

Developers mostly use Swift. So to find OBJECTIVE-C sample is not so easy. Anyway Swift samples also good and you can search Swift blogs. Main task is to understand a sequence of actions.
 
Upvote 0

jkhazraji

Active Member
Licensed User
Well. What a puzzle!! That is what I did. I used NativeObject.
 
Upvote 0
Top