hcaptcha / hcaptcha-ios-sdk Goto Github PK
View Code? Open in Web Editor NEWHCaptcha SDK for iOS
License: Other
HCaptcha SDK for iOS
License: Other
Swift Package gets popular day by day and in our case, it's the default dependency management tool. It would be nice to have SPM integration possibility
Android behavior has several advances that iOS SDK still does not have
markUsed
for a token that will prevent expired errors from being firedwebView
automatically once a token is generated or an error happenscc @e271828-
The SDK includes a html file as a resource. This prevents linking the library statically, which has the benefit of reducing the time for launching apps.
Goal of change: provide the html data as a string in source code. For our dev/debug sanity, we may want this to be done at build time by reading in the file.
set-output
command is deprecated and will be disabled soon.Terms
or Privacy
links should lead to corresponding pages
hcaptcha.validate
and try to click Terms
or Privacy
links
Terms
or Privacy
links should lead to corresponding pages
It works on Android
Add a method to explicitly allow the user of the package to redraw the webview. This would allow a user to update the webviews bounds depending on the state of the hcapcha challenge.
Currently AFAIK, the webview can only be sized at init or when reset(), I'd like to change the webview bounds when the challenge is passed with success.
The feature will be complete when these things are done:
I'm currently bypassing this locally by adding a reload method to the Hcapcha class, which calls a forceRedrawWebView to the Hcapcha manager, which then call the configureWebview closure passed at initialisation time, but I'd like this to be in the source package.
How to integrate in iOS project through SPM?
Is there a potential to reduce it?
There seems to be a delay on init, and it blocks the thread, looks like it is this:
public let json: String = HCaptchaDebugInfo.buildDebugInfoJson()
If I disable the buildDebugInfoJson()
then the init is instant.
I tried multiple versions, and all work the same. It is especially apparent on the simulator.
Goal: we want validate
to return as quickly as possible, especially in passive sitekey case.
I believe this already happens at app start, but there may be some other low-hanging fruit here.
Hi,
I tried to integrate the hCaptcha ios SDK with my ionic app. I can send the data from the javascript to the native code (siteKey) but I'm not sure how to show the captcha challenge
import Capacitor
import HCaptcha
@objc(HCaptchaPlugin)
public class HCaptchaPlugin: CAPPlugin {
@objc func verifyCaptcha(_ call: CAPPluginCall) {
let siteKey = call.getString("siteKey") ?? ""
DispatchQueue.main.sync { // <= run this code in main thread
let hcaptcha = try? HCaptcha(
apiKey: siteKey,
baseURL: URL(string: "https://hcaptcha.com")! // not sure why we need this one, I don't see it on the android sdk ?
)
hcaptcha?.configureWebView { [weak self] webview in
webview.frame = self?.bridge?.viewController?.view.bounds ?? CGRect.zero
}
// I'm not sure how to get view input here, is `self.bridge?.webView` right?
hcaptcha?.validate(on: self.bridge?.webView as! UIView) { [weak self] (result: HCaptchaResult) in
call.resolve([
"data": result,
"status": "success"
])
}
}
}
}
I made it work on Android but not on iOS 🤔
Log on Xcode:
To Native -> hCaptcha verifyCaptcha 91927509
2021-07-23 09:47:03.292207+0700 App[848:661499] WF: _userSettingsForUser mobile: {
filterBlacklist = (
);
filterWhitelist = (
);
restrictWeb = 1;
useContentFilter = 0;
useContentFilterOverrides = 0;
whitelistEnabled = 0;
}
2021-07-23 09:47:03.292294+0700 App[848:661499] WF: _WebFilterIsActive returning: NO
2021-07-23 09:47:21.399858+0700 App[848:661499] Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service
2021-07-23 09:47:21.401830+0700 App[848:661499] Could not signal service com.apple.WebKit.Networking: 113: Could not find specified service
Thanks.
A clear and concise description of what the bug is.
Steps to reproduce the behavior:
The HCaptcha
constructor accepts a diagnosticLog
flag (bool) to enable detailed SDK logs. If you would like to report an issue with the SDK, please enable this flag and attach diagnosticLog
output when you open the issue.
A clear and concise description of what you expected to happen.
Please add as many logs as you feel necessary. Be mindful of your application and remove any sensitive data.
Add any other context about the problem here.
Add a workflow that triggers the deploy/release flow from master.
The feature will be complete when these things are done:
The feature will be complete when these things are done:
Apple introduced support for Private Access Token for iOS 16 that allows to verify users without captcha's input. The support can be implemented on captcha's side.
The feature will be complete when these things are done:
https://github.com/hCaptcha/HCaptcha-ios-sdk/actions/runs/4000836391
...
/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/CocoaPods-Lint-20230124-2729-lan9ye-HCaptcha/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.2.99. (in target 'Pods-App' from project 'Pods')
[22:35:20]: ▸ /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/CocoaPods-Lint-20230124-2729-lan9ye-HCaptcha/App.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.2.99. (in target 'App' from project 'App')
[22:35:20]: ▸ error: Cannot code sign because the target does not have an Info.plist file and one is not being generated automatically. Apply an Info.plist file to the target using the INFOPLIST_FILE build setting or generate one automatically by setting the GENERATE_INFOPLIST_FILE build setting to YES (recommended). (in target 'App' from project 'App')
[22:35:20]: ▸ /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/CocoaPods-Lint-[202](https://github.com/hCaptcha/HCaptcha-ios-sdk/actions/runs/4000836391/jobs/6866779682#step:4:203)30124-2729-lan9ye-HCaptcha/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.2.99. (in target 'HCaptcha' from project 'Pods')
...
Question received:
configureWebView() is required to be called, but does it require the webview to be set to the view.bounds? When setting it to view.bounds, it seems that even after the invisible challenge is completed, the webview doesn't go away resulting in a blank screen on top of the underlying view. When setting it to CGRect.zero, it doesn't block the view at all, so can we do that?
webview.bounds = view.bounds
requiredSupport more events in onEvent
. A full list of events that need to be supported can be found in https://docs.hcaptcha.com/configuration (*-callback
)
Report: when adding the hCaptcha WkWebview to a container with a blur background the Webview is not loading sometimes.
Snippet:
hcaptcha?.configureWebView { [weak self] webview in
webview.frame = self?.captchaContainerView.bounds ?? CGRect.zero
}
hcaptcha?.validate(on: captchaContainerView,
resetOnError: true,
completion: { [weak self] result in
guard let self = self else {
completionHandler(false, nil, ZError.default)
return
}
self.captchaBackgroundView.zHide()
self.captchaBackgroundView.removeFromSuperview()
self.hcaptcha?.stop()
if let data = try? result.dematerialize() {
ZLog.i(data)
completionHandler(true, data, nil)
}
else {
completionHandler(false, nil, ZError.default)
}
})
A clear and concise description of what the bug is.
Steps to reproduce the behavior:
The HCaptcha
constructor accepts a diagnosticLog
flag (bool) to enable detailed SDK logs. If you would like to report an issue with the SDK, please enable this flag and attach diagnosticLog
output when you open the issue.
A clear and concise description of what you expected to happen.
Please add as many logs as you feel necessary. Be mindful of your application and remove any sensitive data.
Add any other context about the problem here.
Add support for JS SDK's theme features.
The feature will be complete when these things are done:
theme
option into init.Example string values: light
dark
etc: https://docs.hcaptcha.com/configuration#themes
customTheme
object into init.Usage looks like:
passing a value in init causes it to add custom=true
to api.js
params.
render function is updated to execute following this pattern:
var onLoad = function() {
hcaptcha.render("h-captcha", {
"sitekey": "<sitekey>",
"theme" : {
primary: {
main: "#00FF00"
},
text: {
heading: "#454545",
body : "#8C8C8C"
}
}
});
};
customTheme
is provided to init as JSON for everyone's sanity.This is nearly identical to #8 but requires passing host
field as an argument to api.js when present in the HCaptcha initializer.
Captcha is not displaying puzzle using iOS 14.5 Simulator
Steps to reproduce the behavior:
invisible
then nothing happens at all, but if compact
is being used, then checkmark displays, but after pressing 'I am a human' nothing happens except one flicker.Sample code:
captchaWebView?.removeFromSuperview()
hCaptcha.configureWebView { [weak self] webview in
self?.captchaWebView = webview
webview.frame = view.bounds
}
hCaptcha.validate(on: view) { [weak self] result in
guard let self = self else {
return
}
print(try! result.dematerialize())
self.captchaWebView?.removeFromSuperview()
}
hCaptcha displays puzzle
[JS LOG]: challenge executing
[JS LOG]: showing challenge
2022-12-08 23:55:41.012306+1000 APP_NAME[92271:1276150] [ProcessSuspension] 0x12b1b1c80 - ProcessAssertion: Failed to acquire RBS Background assertion 'ConnectionTerminationWatchdog' for process because PID is invalid
2022-12-08 23:55:41.012478+1000 APP_NAME[92271:1276150] [Process] 0x152859018 - [pageProxyID=5, webPageID=6, PID=92278] WebPageProxy::processDidTerminate: (pid 92278), reason 3
2022-12-08 23:55:41.026291+1000 APP_NAME[92271:1276150] [assertion] Error acquiring assertion: <Error Domain=RBSAssertionErrorDomain Code=3 "Target is not running or required target entitlement is missing" UserInfo={RBSAssertionAttribute=<RBSDomainAttribute| domain:"com.apple.webkit" name:"Background" sourceEnvironment:"(null)">, NSLocalizedFailureReason=Target is not running or required target entitlement is missing}>
2022-12-08 23:55:41.026374+1000 APP_NAME[92271:1276150] [ProcessSuspension] 0x12b1b1cc0 - ProcessAssertion: Failed to acquire RBS Background assertion 'WebProcess Background Assertion' for process with PID 92278, error: Error Domain=RBSAssertionErrorDomain Code=3 "Target is not running or required target entitlement is missing" UserInfo={RBSAssertionAttribute=<RBSDomainAttribute| domain:"com.apple.webkit" name:"Background" sourceEnvironment:"(null)">, NSLocalizedFailureReason=Target is not running or required target entitlement is missing}
2022-12-08 23:55:41.029488+1000 APP_NAME[92271:1276150] [Loading] 0x152859018 - [pageProxyID=5, webPageID=6, PID=92278] WebPageProxy::dispatchProcessDidTerminate: reason = 3
Seems like thats an iOS bug related to WKWebView. I've tried enabling background capabilities but it didnt help. We have our own implementation of Google's ReCaptcha but I dont see any big difference in codes related to webview handling, so I am not kind of sure thats WKWebView problem
why iOS sdk errors different from android sdk errors? I need to handle for example this one
/**
* Internet connection is missing.
*
* Make sure AndroidManifest requires internet permission: {@code {@literal <}uses-permission android:name="android.permission.INTERNET" /{@literal >}}
*/
NETWORK_ERROR(7, "No internet connection"),
/**
* hCaptcha session timed out either the token or challenge expired
*/
SESSION_TIMEOUT(15, "Session Timeout"),
/**
* Rate limited due to too many tries.
*/
RATE_LIMITED(31, "Rate Limited"),
but instead it stays at the JS log level
The release will be complete when these things are done:
We are scanning for v*
but should either be looking for <int>
or switch back to the previous tag pattern.
See if there are any items we want to address. PR quick ones, create issue for anything more involved.
iOS versions below 10.0 require ES5. This is way less than 1% of devices. Do we still care? Unclear, but it is a small amount of effort to stay compatible.
In the future, we may instead babelize the JS to ES5 to ensure compatibility with old iOS versions once we start using ES6 features.
Also Xcode reports complation issues while it still allows to run the Example targets
/ios-sdk/Example/HCaptcha/ViewController.swift:9:8 Compiling for iOS 9.0, but module 'HCaptcha' has a minimum deployment target of iOS 12.0: /Users/camobap/Library/Developer/Xcode/DerivedData/HCaptcha-dwcvhnkghmwotpfcynmdvgucadgn/Index.noindex/Build/Products/Debug-iphonesimulator/HCaptcha.swiftmodule/x86_64-apple-ios-simulator.swiftmodule
/ios-sdk/Example/HCaptcha/ViewController.swift:80:21 Dynamic key path member lookup cannot refer to instance method 'didFinishLoading'
/ios-sdk/Example/HCaptcha/ViewController.swift:81:14 Value of type 'Binder<((() -> Void)?) -> ()>' has no member 'debug'
/ios-sdk/Example/HCaptcha/ViewController.swift:85:21 Cannot call value of non-function type 'Binder<_>'
/ios-sdk/Example/HCaptcha/ViewController.swift:85:21 Value of type 'Reactive<HCaptcha>' has no dynamic member 'events' using key path from root type 'HCaptcha'
/ios-sdk/Example/HCaptcha/ViewController.swift:87:39 Cannot infer type of closure parameter 'event' without a type annotation
/ios-sdk/Example/HCaptcha/ViewController.swift:87:46 Cannot infer type of closure parameter 'data' without a type annotation
/ios-sdk/Example/HCaptcha/ViewController.swift:104:36 Cannot call value of non-function type 'Binder<(UIView, Bool, @escaping (HCaptchaResult) -> Void) -> ()>'
/ios-sdk/Example/HCaptcha/ViewController.swift:104:36 Dynamic key path member lookup cannot refer to instance method 'validate(on:resetOnError:completion:)'
/ios-sdk/Example/HCaptcha/ViewController.swift:106:25 Cannot infer contextual base in reference to member 'just'
/ios-sdk/Example/HCaptcha/ViewController.swift:130:32 Cannot infer type of closure parameter '_' without a type annotation
The Swift UI Example from the documentation works just fine, as long as you have not included the code into a NavigationView. If the code is used as the second view in a navigation view, as soon as you hit 'validate', the challenge is issued, but not shown on the screen. After some time, the challenge resets and finally is shown, but it takes about a minute or longer, which is too long for my users to wait.
Maybe I am doing something wrong here. Hints would be much appreciated. On the other hand, maybe the SwiftUI example is too simplistic and should be updated with further details.
I am too unexperienced to see what the problem is, but I've created a reproducer and I got the log output, which reads:
=== AttributeGraph: cycle detected through attribute 7744 ===
2022-07-22 08:50:26.703200+0200 HCaptchaTest[77715:5241039] [LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(
"<NSLayoutConstraint:0x60000062ed50 'BIB_Leading_Leading' H:|-(0)-[_UIModernBarButton:0x150679bf0] (active, names: '|':_UIButtonBarButton:0x15211f930 )>",
"<NSLayoutConstraint:0x60000062fac0 'UINav_static_button_horiz_position' _UIModernBarButton:0x150679bf0.leading == UILayoutGuide:0x600001c15b20'UIViewLayoutMarginsGuide'.leading (active)>",
"<NSLayoutConstraint:0x60000062fb10 'UINavItemContentGuide-leading' H:[_UIButtonBarButton:0x15211f930]-(6)-[UILayoutGuide:0x600001c15a40'UINavigationBarItemContentLayoutGuide'] (active)>",
"<NSLayoutConstraint:0x600000658e60 'UINavItemContentGuide-trailing' UILayoutGuide:0x600001c15a40'UINavigationBarItemContentLayoutGuide'.trailing == _UINavigationBarContentView:0x15211a4b0.trailing (active)>",
"<NSLayoutConstraint:0x6000006251d0 'UIView-Encapsulated-Layout-Width' _UINavigationBarContentView:0x15211a4b0.width == 0 (active)>",
"<NSLayoutConstraint:0x600000659180 'UIView-leftMargin-guide-constraint' H:|-(8)-[UILayoutGuide:0x600001c15b20'UIViewLayoutMarginsGuide'](LTR) (active, names: '|':_UINavigationBarContentView:0x15211a4b0 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x60000062ed50 'BIB_Leading_Leading' H:|-(0)-[_UIModernBarButton:0x150679bf0] (active, names: '|':_UIButtonBarButton:0x15211f930 )>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
2022-07-22 08:50:26.703626+0200 HCaptchaTest[77715:5241039] [LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(
"<NSLayoutConstraint:0x60000062eda0 'BIB_Trailing_CB_Leading' H:[_UIModernBarButton:0x150679bf0]-(6)-[_UIModernBarButton:0x15211fd10'Main Page'] (active)>",
"<NSLayoutConstraint:0x60000062edf0 'CB_Trailing_Trailing' _UIModernBarButton:0x15211fd10'Main Page'.trailing <= _UIButtonBarButton:0x15211f930.trailing (active)>",
"<NSLayoutConstraint:0x60000062fac0 'UINav_static_button_horiz_position' _UIModernBarButton:0x150679bf0.leading == UILayoutGuide:0x600001c15b20'UIViewLayoutMarginsGuide'.leading (active)>",
"<NSLayoutConstraint:0x60000062fb10 'UINavItemContentGuide-leading' H:[_UIButtonBarButton:0x15211f930]-(6)-[UILayoutGuide:0x600001c15a40'UINavigationBarItemContentLayoutGuide'] (active)>",
"<NSLayoutConstraint:0x600000658e60 'UINavItemContentGuide-trailing' UILayoutGuide:0x600001c15a40'UINavigationBarItemContentLayoutGuide'.trailing == _UINavigationBarContentView:0x15211a4b0.trailing (active)>",
"<NSLayoutConstraint:0x6000006251d0 'UIView-Encapsulated-Layout-Width' _UINavigationBarContentView:0x15211a4b0.width == 0 (active)>",
"<NSLayoutConstraint:0x600000659180 'UIView-leftMargin-guide-constraint' H:|-(8)-[UILayoutGuide:0x600001c15b20'UIViewLayoutMarginsGuide'](LTR) (active, names: '|':_UINavigationBarContentView:0x15211a4b0 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x60000062eda0 'BIB_Trailing_CB_Leading' H:[_UIModernBarButton:0x150679bf0]-(6)-[_UIModernBarButton:0x15211fd10'Main Page'] (active)>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
2022-07-22 08:50:26.704075+0200 HCaptchaTest[77715:5241039] [LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(
"<NSLayoutConstraint:0x60000062e2b0 UIView:0x15067c2d0.trailing == _UIBackButtonMaskView:0x15067bb70.trailing (active)>",
"<NSLayoutConstraint:0x60000062f390 'Mask_Trailing_Trailing' _UIBackButtonMaskView:0x15067bb70.trailing == _UIButtonBarButton:0x15211f930.trailing (active)>",
"<NSLayoutConstraint:0x60000062f4d0 'MaskEV_Leading_BIB_Trailing' H:[_UIModernBarButton:0x150679bf0]-(0)-[UIView:0x15067c2d0] (active)>",
"<NSLayoutConstraint:0x60000062fac0 'UINav_static_button_horiz_position' _UIModernBarButton:0x150679bf0.leading == UILayoutGuide:0x600001c15b20'UIViewLayoutMarginsGuide'.leading (active)>",
"<NSLayoutConstraint:0x60000062fb10 'UINavItemContentGuide-leading' H:[_UIButtonBarButton:0x15211f930]-(6)-[UILayoutGuide:0x600001c15a40'UINavigationBarItemContentLayoutGuide'] (active)>",
"<NSLayoutConstraint:0x600000658e60 'UINavItemContentGuide-trailing' UILayoutGuide:0x600001c15a40'UINavigationBarItemContentLayoutGuide'.trailing == _UINavigationBarContentView:0x15211a4b0.trailing (active)>",
"<NSLayoutConstraint:0x6000006251d0 'UIView-Encapsulated-Layout-Width' _UINavigationBarContentView:0x15211a4b0.width == 0 (active)>",
"<NSLayoutConstraint:0x600000659180 'UIView-leftMargin-guide-constraint' H:|-(8)-[UILayoutGuide:0x600001c15b20'UIViewLayoutMarginsGuide'](LTR) (active, names: '|':_UINavigationBarContentView:0x15211a4b0 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x60000062e2b0 UIView:0x15067c2d0.trailing == _UIBackButtonMaskView:0x15067bb70.trailing (active)>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
[JS LOG]: recaptchacompat disabled
[JS LOG]: challenge onload starting
2022-07-22 08:50:26.921469+0200 HCaptchaTest[77715:5241039] [ViewportSizing] maximumViewportInset cannot be larger than frame
2022-07-22 08:50:26.921518+0200 HCaptchaTest[77715:5241039] [ViewportSizing] minimumViewportInset cannot be larger than frame
2022-07-22 08:50:26.921705+0200 HCaptchaTest[77715:5241039] [ViewportSizing] maximumViewportInset cannot be larger than frame
2022-07-22 08:50:26.921735+0200 HCaptchaTest[77715:5241039] [ViewportSizing] minimumViewportInset cannot be larger than frame
2022-07-22 08:50:30.037883+0200 HCaptchaTest[77715:5241039] [ViewportSizing] maximumViewportInset cannot be larger than frame
2022-07-22 08:50:30.038063+0200 HCaptchaTest[77715:5241039] [ViewportSizing] minimumViewportInset cannot be larger than frame
[JS LOG]: challenge executing
[JS LOG]: showing challenge
[JS LOG]: challenge opened
2022-07-22 08:50:31.845902+0200 HCaptchaTest[77715:5241039] [HardwareKeyboard] -[UIApplication getKeyboardDevicePropertiesForSenderID:shouldUpdate:usingSyntheticEvent:], failed to fetch device property for senderID (778835616971358211) use primary keyboard info instead.
2022-07-22 08:50:31.847408+0200 HCaptchaTest[77715:5241039] [HardwareKeyboard] -[UIApplication getKeyboardDevicePropertiesForSenderID:shouldUpdate:usingSyntheticEvent:], failed to fetch device property for senderID (778835616971358211) use primary keyboard info instead.
[JS LOG]: expired challenge
[JS LOG]: challenge resetting
[JS LOG]: challenge executing
[JS LOG]: showing challenge
[JS LOG]: challenge opened
I'm using HCaptcha to save my app from being attacked with some requests so I need it to challenge our users every time, but the behaviour is when I do the captcha test for the first time, it's not shown, if I back on the same run and I clicked the button that launches the captcha again I will see it work, while the first time captcha returns valid token without running the manual quiz .
Steps to reproduce the behavior:
I need the test to be available every time I launch the captcha.
after @import HCaptcha;
all classes / methods are not accessible by default in objective C.
kindly adjust, thx
Right now we produce error messages like:
Can't find variable: reset
Can't find variable: execute
If resources cannot be loaded, e.g. if user goes out of service in the midst of a session.
As in title :)
Proof: https://cocoapods.org/pods/HCaptcha
Could you please release it so that other can make benefits of latests changes?
thread #1, queue = 'com.apple.main-thread', stop reason = Fatal error: Unexpectedly found nil while unwrapping an Optional value
frame #0: 0x000000010c91aa80 libswiftCore.dylib`_swift_runtime_on_report
frame #1: 0x000000010c9950e3 libswiftCore.dylib`_swift_stdlib_reportFatalErrorInFile + 211
frame #2: 0x000000010c624f30 libswiftCore.dylib`closure #1 (Swift.UnsafeBufferPointer<Swift.UInt8>) -> () in closure #1 (Swift.UnsafeBufferPointer<Swift.UInt8>) -> () in closure #1 (Swift.UnsafeBufferPointer<Swift.UInt8>) -> () in Swift._assertionFailure(_: Swift.StaticString, _: Swift.StaticString, file: Swift.StaticString, line: Swift.UInt, flags: Swift.UInt32) -> Swift.Never + 480
frame #3: 0x000000010c624a87 libswiftCore.dylib`closure #1 (Swift.UnsafeBufferPointer<Swift.UInt8>) -> () in closure #1 (Swift.UnsafeBufferPointer<Swift.UInt8>) -> () in Swift._assertionFailure(_: Swift.StaticString, _: Swift.StaticString, file: Swift.StaticString, line: Swift.UInt, flags: Swift.UInt32) -> Swift.Never + 87
frame #4: 0x000000010c624763 libswiftCore.dylib`closure #1 (Swift.UnsafeBufferPointer<Swift.UInt8>) -> () in Swift._assertionFailure(_: Swift.StaticString, _: Swift.StaticString, file: Swift.StaticString, line: Swift.UInt, flags: Swift.UInt32) -> Swift.Never + 99
frame #5: 0x000000010c6243e1 libswiftCore.dylib`Swift._assertionFailure(_: Swift.StaticString, _: Swift.StaticString, file: Swift.StaticString, line: Swift.UInt, flags: Swift.UInt32) -> Swift.Never + 513
frame #6: 0x00000001070a678a MY-APP SEA`HCaptchaDebugInfo.buildDebugInfo(self=0x0000600000333b00) at HCaptchaDebugInfo.swift:44:66
frame #7: 0x00000001070a6129 MY-APP SEA`HCaptchaDebugInfo.buildDebugInfoJson(self=0x0000600000333b00) at HCaptchaDebugInfo.swift:30:50
frame #8: 0x00000001070a600a MY-APP SEA`HCaptchaDebugInfo.init(self=0x0000600000333b00) at HCaptchaDebugInfo.swift:24:26
frame #9: 0x00000001070a5fc1 MY-APP SEA`HCaptchaDebugInfo.__allocating_init() at HCaptchaDebugInfo.swift:0
frame #10: 0x00000001070ae604 MY-APP SEA`HCaptchaWebViewManager.init(html="<html>\n <head>\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, user-scalable=no\"/>\n \n <style>\n * {\n padding: 0;\n margin: 0;\n }\n body {\n display: table;\n width: 100%;\n height: 100%;\n text-align: center;\n }\n #hcaptcha-container {\n margin-top: 5px;\n display: table-cell;\n vertical-align: middle;\n }\n /* overwrite hCaptcha iframe overlay which adds a #FFF background with opacity 0.05 */\n div > div:nth-child(2) {\n opacity: 0 !important;\n }\n </style>\n <script type=\"text/javascript\">\n JSON.parse('${debugInfo}' || \"[]\").forEach(function (value, i) { window[value] = true; });\n </script>\n <script type=\"text/javascript\">\n var script = document.createElement('script');\n script.src = \"${endpoint}\";\n\n script.onerror = function () {\n // network issue\n post({ error: 7 });\n "..., apiKey="MY-SITEKEY", baseURL="https://localhost", endpoint="https://js.hcaptcha.com/1/api.js?onload=onloadCallback&render=explicit&recaptchacompat=off&host=MY-SITEKEY.ios-sdk.hcaptcha.com&sentry=false", size=invisible, rqdata=nil, theme="\"light\"", self=0x0000600003548420) at HCaptchaWebViewManager.swift:69:33
Hey all,
I am trying to integrate HCaptcha for the first time into my project, I am running into an issue where I try to configure the web view and its valued as nil. Installed via CocoaPods. v.2.0.0
I have added my HCAPTCHA Key and HCaptchaDomain - "https://localhost.com" to my info.pList.
If anyone can help me troubleshoot, that would be great.
For metrics etc; parallel of hCaptcha/hcaptcha-android-sdk#28
Looks like we have showHCaptcha
already, so just need a convenient public way to bind to it.
I try to add an HCaptchaView following the example to an iOS App build using SwiftUI. I've got a LoginScreen that is a NavigationStack and leads to a RegistrationScreen upon user request. The RegistrationScreen is embedded inside the NavigationStack from the LoginScreen, so the user can easily navigate back. The problem is, that the challenge takes forever to appear as long as I have that NavigationStack around everything. As soon as I remove the NavigationStack everything works fine.
Steps to reproduce the behavior:
It should behave inside a NavigationStack the same way as outside of it
I am using iOS 16.2 and version 2.5.0 of this library.
See list here: https://github.com/hCaptcha/hcaptcha-android-sdk
Match of hCaptcha/hcaptcha-android-sdk#103
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.