iOS Question Firebase Get Token doesn't work

ykucuk

Well-Known Member
Licensed User
Longtime User
B4X:
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

Any help ?
B4i v6.80
Firebase v2.50
 

Attachments

  • Screen Shot 2020-08-02 at 04.08.08.png
    Screen Shot 2020-08-02 at 04.08.08.png
    60.2 KB · Views: 149

Semen Matusovskiy

Well-Known Member
Licensed User
A subroutine works fine under B4i v6.80 + Firebase v2.50. Of course, if other was configurated correctly.

Try attached example in Simulator (you need to add own GoogleService-info.plist to Files\Special )
 

Attachments

  • Q.zip
    993 bytes · Views: 134
Upvote 0

ykucuk

Well-Known Member
Licensed User
Longtime User
Please post the error as text.
B4X:
Application_Start
Error occurred on line: 48 (Main)
Object was not initialized (NSObject)
Stack Trace: (
  CoreFoundation       __exceptionPreprocess + 331
  libobjc.A.dylib      objc_exception_throw + 48
  CoreFoundation       +[NSException raise:format:] + 197
  B4iExample           -[B4IObjectWrapper object] + 139
  B4iExample           -[B4INativeObject RunMethod::] + 116
  B4iExample           -[b4i_main _gettoken] + 515
  B4iExample           -[ResumableSub_main_Application_Start resume::] + 828
  B4iExample           -[b4i_main _application_start:] + 501
  CoreFoundation       __invoking___ + 140
  CoreFoundation       -[NSInvocation invoke] + 325
 B4iExample           +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1669
 B4iExample           -[B4IShell runMethod:] + 401
 B4iExample           -[B4IShell raiseEventImpl:method:args::] + 1775
 B4iExample           -[B4IShellBI raiseEvent:event:params:] + 1357
 B4iExample           __33-[B4I raiseUIEvent:event:params:]_block_invoke + 51
 libdispatch.dylib    _dispatch_call_block_and_release + 12
 libdispatch.dylib    _dispatch_client_callout + 8
 libdispatch.dylib    _dispatch_main_queue_callback_4CF + 1276
 CoreFoundation       __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
 CoreFoundation       __CFRunLoopRun + 2310
 CoreFoundation       CFRunLoopRunSpecific + 626
 GraphicsServices     GSEventRunModal + 65
 UIKitCore            UIApplicationMain + 140
 B4iExample           main + 112
 libdyld.dylib        start + 1
)
Application_Active
 
Upvote 0

ykucuk

Well-Known Member
Licensed User
Longtime User
A subroutine works fine under B4i v6.80 + Firebase v2.50. Of course, if other was configurated correctly.

Try attached example in Simulator (you need to add own GoogleService-info.plist to Files\Special )
It does work with FirebaseAnalytics but doesn't work with Notification
 
Upvote 0
Top