GoogleApisForiOSComponents icon indicating copy to clipboard operation
GoogleApisForiOSComponents copied to clipboard

Firebase.Crashlytics.StackFrame.Create(nuint address) has wrong method selector

Open aliyailina opened this issue 1 year ago • 0 comments

Calling Firebase.Crashlytics.StackFrame.Create(nuint address) causes unrecognized selector exception.

[Export] attribute has wrong selector parameter stackFrameWithAddress:address, while it must be stackFrameWithAddress:.

Workaround

You can invoke method directly as described in documentation.

Declare this method somewhere (usually, in class where you use it):

[DllImport("/usr/lib/libobjc.dylib", EntryPoint = "objc_msgSend")]
internal static extern IntPtr IntPtr_objc_msgSend_UIntPtr(IntPtr receiver, IntPtr selector, UIntPtr arg1);

Then use it like this:

using ObjCRuntime;
using Firebase.Crashlytics;

...


var stackFramePointer = IntPtr_objc_msgSend_UIntPtr(new Class(typeof(StackFrame)).Handle, Selector.GetHandle("stackFrameWithAddress:"), (UIntPtr)address);
var stackFrame = Runtime.GetNSObject<StackFrame>(stackFramePointer);

aliyailina avatar Mar 20 '24 13:03 aliyailina