@Generated
@Selector("providerData")
public native NSArray<?> providerData();
Problem is that an NSArray<id<FIRUserInfo>> has changed to NSArray<?>. Trying to cast elements back to ``FIRUserInfo I’m getting an java cast exception.
How MOE is handling NSArray<id<T>> types and how can I access elements of this NSArray in Java?
I have same FIRUserInfo interface as it is in moe-bindings repo:
Adding @RegisterOnStartup is unfortunately not fixing the issue:
*** Terminating app due to uncaught exception 'java.lang.ClassCastException', reason: 'java.lang.ClassCastException: apple.NSObject cannot be cast to com.myapp.ios.pods.firebase.firebaseauth.protocol.FIRUserInfo
this can happen, when the Java binding type of the objects passed from ObjC to Java cannot be determined. In this case NSObject is used as a fallback.
This can happen if the object returned is of a private type (i.e. not defined in the headers that were used by Natjgen to generate the binding). We provide these cast*() methods to aid in these situations.
The general algorithm is to use the runtime type of the ObjC object to look for the Java binding type. If that type cannot be found among the Nat/J bindings, we are traversing the ObjC type hierarchy up to NSObject.
It is on the TODO list to generate more precise bindings for NSArray like parameters, but the ObjC -> Java mapping of these generics has a lot of edge cases, and Natjgen will have to be refactored to support all these cases correctly.
Mateusz, is there any way you could share a snippet of your implementation code in which you got Firebase Auth to work correctly? I assume the flow allows a user to authenticate with a Google account, but I’m having some trouble with implementation.
Hi there!
I’m currently implementing vast Firebase support for our app, including Authentication, Analytics and Realtime Database.
It is quite a lot of work and I will surely create a comprehensive step-by-step tutorial, but now I have some features to deliver on time