Closed mandelmonkey closed 7 months ago
Hello @mandelmonkey, I was unable to reproduce your issue. I tested our SDK v2.4.0 on multiple simulated and real devices (iOS 15, 16 and 17), Xcode 15.3 (15E204a), and everything worked as expected.
Here is the code that I used for testing:
import FingerprintPro
import SwiftUI
enum Identification {
static func getVisitorId() async -> String {
do {
let client = FingerprintProFactory.getInstance("<api-key>")
let response = try await client.getVisitorIdResponse()
return response.visitorId
} catch {
return error.localizedDescription
}
}
}
struct ContentView: View {
@State private var visitorId: String = ""
var body: some View {
VStack {
Text(visitorId)
}
.padding()
.task {
visitorId = await Identification.getVisitorId()
}
}
}
#Preview {
ContentView()
}
[!CAUTION] Please DO NOT enclose your API keys in the issue description. Use placeholder (e.g.
<api-key>
) instead.
I made a couple of changes to your code, such that the getVisitorId()
method returns response.visitorId
rather than visitorId.requestId
and the catch block returns error.localizedDescription
instead of a string literal. I honestly don't understand why you decided to return visitorId.requestId
, since the request ID identifies the network request rather than the device. Nonetheless, none of these changes explains why you could experience the described behavior.
I have two follow up questions to you:
getVisitorId()
method? Maybe it has something to do with how you use Swift's concurrency system.I also strongly advise you to check our new fingerprint-device-intelligence-ios-demo repo, which serves as a good example of how to integrate and use the Fingerprint Identification SDK in your iOS app. You'll find lots of useful information there, including the best coding practices to be followed.
@mgutski Thank you for taking the time to confirm it works on multiple simulated and physical that helped me confirm the issue was to do with our wrapper
we are using the fingerprint in a Unity project and had to write some wrapper to import and call the function, so it was no a conventional way of doing so.
Something from version 2.1.7 didnt like our wrapper but after refactoring it we now have it working in version 2.4.0
For reference we are getting the requestId because this is sent to our backend in order to look up/validate a request happened and that it happened recently (to mitigate some attack vector). This was a decision by the backend team so I cant give more detail
Okay, I see, good to know that you figured out the problem with your wrapper and the SDK is working for you.
For reference we are getting the requestId because this is sent to our backend in order to look up/validate a request happened and that it happened recently (to mitigate some attack vector).
Right, you may send the requestId
to your backend, such that it can then fetch the identification event details via Fingerprint Pro Server API. However, if that's your use case, I would suggest to rename your getVisitorId()
method to something more meaningful (e.g. fingerprintDevice()
) to avoid confusion and ambiguity.
Hello
I was using the 2.0.0 release and I could get the viditorId ok, after upgrading to version 2.4.0 and changing nothing else the function seems to hang/freeze on
try await client.getVisitorIdResponse()
and never completes or timeout no error is thrownAm I doing something wrong?
Xcode is Version 15.3 (15E204a)
After testing the issue doesnt exist up to 2.1.5 but does in version 2.1.7