G George_G Member Licensed User Apr 4, 2023 #1 Hello, my app does not working after the last update of B4I and B4iBuildServer. It is an app, in which user subscribes to a topic (Firebase push notification), and after the subscription, I use a method named GetToken. (I found this method in another post) B4X: Copy Private Sub GetToken As String Dim no As NativeObject Dim token As NativeObject = no.Initialize("FIRInstanceID").RunMethod("instanceID", Null).RunMethod("token", Null) If token.IsInitialized Then Return token.AsString Else Return "" End Sub But after the last update, when I compile my app and execute the GetToken method, I get this error (attached file). The line of the error is this one: Dim token As NativeObject = no.Initialize("FIRInstanceID").RunMethod("instanceID", Null).RunMethod("token", Null) Any advice? Thank you in advance! Attachments Error.txt Error.txt 2.1 KB · Views: 496
Hello, my app does not working after the last update of B4I and B4iBuildServer. It is an app, in which user subscribes to a topic (Firebase push notification), and after the subscription, I use a method named GetToken. (I found this method in another post) B4X: Copy Private Sub GetToken As String Dim no As NativeObject Dim token As NativeObject = no.Initialize("FIRInstanceID").RunMethod("instanceID", Null).RunMethod("token", Null) If token.IsInitialized Then Return token.AsString Else Return "" End Sub But after the last update, when I compile my app and execute the GetToken method, I get this error (attached file). The line of the error is this one: Dim token As NativeObject = no.Initialize("FIRInstanceID").RunMethod("instanceID", Null).RunMethod("token", Null) Any advice? Thank you in advance!
Andrew (Digitwell) Well-Known Member Licensed User Longtime User Apr 4, 2023 #2 The error is : Error occurred on line: 145 (Main) Object was not initialized (NSObject) Click to expand... Don't you need to initialize "no"? Upvote 0
The error is : Error occurred on line: 145 (Main) Object was not initialized (NSObject) Click to expand... Don't you need to initialize "no"?
G George_G Member Licensed User Apr 4, 2023 #3 Andrew (Digitwell) said: The error is : Don't you need to initialize "no"? Click to expand... This code worked fine, before the update. Isn't it an initialization? B4X: Copy no.Initialize("FIRInstanceID").RunMethod("instanceID", Null).RunMethod("token", Null) Upvote 0
Andrew (Digitwell) said: The error is : Don't you need to initialize "no"? Click to expand... This code worked fine, before the update. Isn't it an initialization? B4X: Copy no.Initialize("FIRInstanceID").RunMethod("instanceID", Null).RunMethod("token", Null)
G George_G Member Licensed User Apr 4, 2023 #4 Just found this post B4I 8.30 FireBase Token Was there any change to the FB notifications, the way we retrieve the token? Public Sub Firebase_FCMConnected xc.Logd("fm_FCMConnected") xc.registerTopics Dim token As String=GetToken If token"" Then xc.logd("firebaseToken:" & token) kvs.Put("firebaseToken"... www.b4x.com I will try it, and I will inform here. Upvote 0
Just found this post B4I 8.30 FireBase Token Was there any change to the FB notifications, the way we retrieve the token? Public Sub Firebase_FCMConnected xc.Logd("fm_FCMConnected") xc.registerTopics Dim token As String=GetToken If token"" Then xc.logd("firebaseToken:" & token) kvs.Put("firebaseToken"... www.b4x.com I will try it, and I will inform here.
G George_G Member Licensed User Apr 4, 2023 #5 Everything works fine now: I replace my GetToken method with the following one: Mr Erel used Dim token As Object, and I got Error. I replace it with Dim token As NativeObject B4X: Copy Private Sub GetToken As String Dim FIRMessaging As NativeObject FIRMessaging = FIRMessaging.Initialize("FIRMessaging").GetField("messaging") Dim token As Object = FIRMessaging.GetField("FCMToken") If token = Null Then Return "" Else Return token.As(String) End Sub Upvote 0
Everything works fine now: I replace my GetToken method with the following one: Mr Erel used Dim token As Object, and I got Error. I replace it with Dim token As NativeObject B4X: Copy Private Sub GetToken As String Dim FIRMessaging As NativeObject FIRMessaging = FIRMessaging.Initialize("FIRMessaging").GetField("messaging") Dim token As Object = FIRMessaging.GetField("FCMToken") If token = Null Then Return "" Else Return token.As(String) End Sub
Erel B4X founder Staff member Licensed User Longtime User Apr 4, 2023 #6 George_G said: Mr Erel used Dim token As Object, and I got Error. Click to expand... Which error did you get? Upvote 0
George_G said: Mr Erel used Dim token As Object, and I got Error. Click to expand... Which error did you get?
G George_G Member Licensed User Apr 4, 2023 #7 Erel said: Which error did you get? Click to expand... Error attached. Attachments Error.txt Error.txt 2 KB · Views: 537 Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Apr 4, 2023 #8 Are you getting it from this code: Code: Copy Private Sub GetToken As String Dim FIRMessaging As NativeObject FIRMessaging = FIRMessaging.Initialize("FIRMessaging").GetField("messaging") Dim token As Object = FIRMessaging.GetField("FCMToken") If token = Null Then Return "" Else Return token.As(String) End Sub ? Which line? Upvote 0
Are you getting it from this code: Code: Copy Private Sub GetToken As String Dim FIRMessaging As NativeObject FIRMessaging = FIRMessaging.Initialize("FIRMessaging").GetField("messaging") Dim token As Object = FIRMessaging.GetField("FCMToken") If token = Null Then Return "" Else Return token.As(String) End Sub ? Which line?
G George_G Member Licensed User Apr 4, 2023 #9 Erel said: Are you getting it from this code: Code: Copy Private Sub GetToken As String Dim FIRMessaging As NativeObject FIRMessaging = FIRMessaging.Initialize("FIRMessaging").GetField("messaging") Dim token As Object = FIRMessaging.GetField("FCMToken") If token = Null Then Return "" Else Return token.As(String) End Sub ? Which line? Click to expand... Dim token As Object = FIRMessaging.GetField("FCMToken") but everything works fine with the following line Dim token As NativeObject = FIRMessaging.GetField("FCMToken") Upvote 0
Erel said: Are you getting it from this code: Code: Copy Private Sub GetToken As String Dim FIRMessaging As NativeObject FIRMessaging = FIRMessaging.Initialize("FIRMessaging").GetField("messaging") Dim token As Object = FIRMessaging.GetField("FCMToken") If token = Null Then Return "" Else Return token.As(String) End Sub ? Which line? Click to expand... Dim token As Object = FIRMessaging.GetField("FCMToken") but everything works fine with the following line Dim token As NativeObject = FIRMessaging.GetField("FCMToken")
Erel B4X founder Staff member Licensed User Longtime User Apr 4, 2023 #10 Code: Copy Private Sub GetToken As String Dim FIRMessaging As NativeObject FIRMessaging = FIRMessaging.Initialize("FIRMessaging").GetField("messaging") Dim token As NativeObject = FIRMessaging.GetField("FCMToken") If token.IsInitialized = False Then Return "" Else Return token.AsString End Sub This is the correct code. I will update the post. Upvote 0
Code: Copy Private Sub GetToken As String Dim FIRMessaging As NativeObject FIRMessaging = FIRMessaging.Initialize("FIRMessaging").GetField("messaging") Dim token As NativeObject = FIRMessaging.GetField("FCMToken") If token.IsInitialized = False Then Return "" Else Return token.AsString End Sub This is the correct code. I will update the post.