You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm a beginner with ffigen but I'm trying to create an example using LocalAuthentication, I was able to generate the bindings and have created an implementation using them, everything works fine until I call evaluatePolicy and the app crashes.
Here is my implementation, I am assuming I have to call evaluatePolicy inside the platform thread as evaluatePolicy will do some ui stuff.
try {
await runOnPlatformThread(() {
final lib = DynamicLibrary.process();
final localAuthentication = LocalAuthentication(lib);
final context = LAContext.new1(localAuthentication);
final error = NSError.new1(localAuthentication);
final canEvaluate = context.canEvaluatePolicy_error_(
LAPolicy.LAPolicyDeviceOwnerAuthentication,
Pointer.fromAddress(error.pointer.address),
);
final completion = ObjCBlock_ffiVoid_bool_NSError.listener(
localAuthentication,
(result, nsError) {
if (result) {
return onSuccess();
} else if (nsError != null) {
onError();
}
},
);
final reason = NSString(localAuthentication, '');
if (canEvaluate) {
context.evaluatePolicy_localizedReason_reply_(
LAPolicy.LAPolicyDeviceOwnerAuthentication,
reason,
completion,
);
}
return;
});
} catch (e) {
print(e);
}
Hi, I'm a beginner with ffigen but I'm trying to create an example using LocalAuthentication, I was able to generate the bindings and have created an implementation using them, everything works fine until I call evaluatePolicy and the app crashes.
Here is my implementation, I am assuming I have to call evaluatePolicy inside the platform thread as evaluatePolicy will do some ui stuff.
ffigen.yaml:
Am I doing something wrong, does my use case make sense?
Let me know if you need more details, thanks in advance!
The text was updated successfully, but these errors were encountered: