iOS Question NativeObject help

yiankos1

Well-Known Member
Licensed User
Longtime User

How can we do this code for b4i?

I initialized first iFirebaseCrashlytics library and then:

B4X:
    #PlistExtra: <key>FirebaseCrashlyticsCollectionEnabled</key><false/>

B4X:
Private Sub GetCrashlytics As NativeObject
    Dim no As NativeObject
    no.Initialize("Crashlytics").RunMethod("crashlytics", Null)
    Return no
End Sub

B4X:
GetCrashlytics.RunMethod("setCrashlyticsCollectionEnabled", Array(True))

i get this error
B4X:
Error occurred on line: 162 (settings)
Method not found: crashlytics, target: Crashlytics
Stack Trace: (
  CoreFoundation       <redacted> + 252
  libobjc.A.dylib      objc_exception_throw + 56
  CoreFoundation       <redacted> + 0
  result               +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 368
  result               -[B4INativeObject RunMethod::] + 216
  CoreFoundation       <redacted> + 144
  CoreFoundation       <redacted> + 292
  result               +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1608
  result               -[B4IShell runVoidMethod] + 232
  result               -[B4IShell raiseEventImpl:method:args::] + 1800
result               -[B4IShellBI raiseEvent:event:params:] + 1580
result               +[B4IDebug delegate:::] + 80
result               -[b4i_settings _getcrashlytics] + 208
result               -[ResumableSub_settings_ConsentStateAvailable resume::] + 3444
CoreFoundation       <redacted> + 144
CoreFoundation       <redacted> + 292
result               +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1608
result               -[B4IShell runMethod:] + 448
result               -[B4IShell raiseEventImpl:method:args::] + 2172
result               -[B4IShellBI raiseEvent:event:params:] + 1580
 
Last edited:

Semen Matusovskiy

Well-Known Member
Licensed User
Which Firebase frameworks do you use ? no.Initialize("Crashlytics") confuses me.
Let's imagine that you use https://www.b4x.com/b4i/files/Firebase250.zip

To include FirebaseCrashlytics it's necessary to add #AdditionalLib : FirebaseCrashlytics.framework.3 and
B4X:
#If OBJC
@import FirebaseCrashlytics;
#End If

2) Initializing.... Let's declare Private noCrashlytics As NativeObject in Process_Globals.
In Application_Start (after FirebaseAnalytics.Initialize)
B4X:
    noCrashlytics = noCrashlytics.Initialize ("FIRCrashlytics").RunMethod ("crashlytics", Null)
    noCrashlytics.Runmethod("setCrashlyticsCollectionEnabled:", Array (True))
As I see, we can set a value using setField also
B4X:
noCrashlytics.SetField ("crashlyticsCollectionEnabled", True)
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…