我实现了facebook连接,它工作正常.
登录后,此函数返回我的名字.
FB.getLoginStatus(function (response) {
if (response && response.status === 'connected') {
FB.api('/me', function(response) {
console.log('Good to see you, ' + response.name + '.');
});
//console.log('connected');
} else {
console.log('not connected with FB');
}
});
Run Code Online (Sandbox Code Playgroud)
但是,当我重新加载页面时,我记得这个函数,它返回'与FB无关'.
我加入登录功能来帮助:
FB.login(function(response) {
if (response.authResponse){
//L'utilisateur a autorisé l'application
//window.location.replace("http://adresse/de/redirection");
} else {
//L'utilisateur n'a pas autorisé l'application
}
}, {scope: 'public_profile,user_friends,email'});
Run Code Online (Sandbox Code Playgroud)
我在facebook文档中找不到任何解决方案
为了显示问题,我的控制台日志是这样的: 使用我的代码控制台日志
编辑:请附上我的完整代码.我从localhost处理
<!DOCTYPE html>
<html>
<head>
<title>Facebook Login JavaScript Example</title>
<meta charset="UTF-8">
</head>
<body>
<button id="loginBtn">Facebook Login</button>
<div id="response"></div>
</body> …Run Code Online (Sandbox Code Playgroud) 我对 Stripe 的测试环境有一个关于 3D 安全流程和订阅的问题。我担心在没有验证或解释问题的情况下将流程推向生产。
\n\n我根据文档执行了所有 3d 安全和订阅过程。
\n\nhttps://stripe.com/docs/sources/third-d-secure/subscriptions
\n\n当我通过禁用试用期来激活订阅时,我所做的所有尝试都失败了。
\n\n\n\n我正在使用需要 3D 安全的测试卡:4000 0000 0000 3063
\n\n我的代码流程:
\n\n<!DOCTYPE html>\n<html lang="fr">\n<head>\n <meta charset="UTF-8">\n <title>Source test Stripe</title>\n <script src="https://js.stripe.com/v3/"></script>\n <style>\n .StripeElement {\n background-color: white;\n height: 40px;\n padding: 10px 12px;\n border-radius: 4px;\n border: 1px solid transparent;\n box-shadow: 0 1px 3px 0 #e6ebf1;\n -webkit-transition: box-shadow 150ms ease;\n transition: box-shadow 150ms ease;\n }\n\n .StripeElement--focus {\n box-shadow: 0 1px 3px 0 #cfd7df;\n }\n\n .StripeElement--invalid {\n border-color: #fa755a;\n }\n\n .StripeElement--webkit-autofill …Run Code Online (Sandbox Code Playgroud) 我尝试使用从Web视图中获取javascript消息WKWebView。但是IOS控制台内部什么也没有出现...
我实现以下代码:
- (void) webView:(WKWebView *)webView didFailLoadWithError:(NSError *)error {
self.webView = [[WKWebView alloc] initWithFrame:CGRectMake(0, 20, self.view.frame.size.width, self.view.frame.size.height-20)];
self.webView.backgroundColor = [UIColor whiteColor];
self.webView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
self.webView.scrollView.delegate = self;
[self.view addSubview:self.webView];
// Setup WKUserContentController instance for injecting user script
WKWebViewConfiguration *configuration = [[WKWebViewConfiguration alloc]
init];
WKUserContentController* userController = [[WKUserContentController alloc]init];
[userController addScriptMessageHandler: self name:@"notification"];
configuration.userContentController = userController;
[self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://example.com/test.php"]]];
}
- (void)userContentController:(WKUserContentController*)userContentController
didReceiveScriptMessage:(WKScriptMessage*)message {
NSLog(@"%@", message.body);
}
Run Code Online (Sandbox Code Playgroud)
和HTML / JS:
<div id="test" onclick="test();">test</div>
<script type="text/javascript" src="jquery.js"></script> …Run Code Online (Sandbox Code Playgroud) 对于一个项目,我会把一个函数的实现和这个函数的调用分开。
它是这样的:
function identity<T, R>(arg: T): R {
return { result: arg };
}
const test = identity<string, { result: string }>;
console.log(test('test'))
Run Code Online (Sandbox Code Playgroud)
我收到此错误:“测试不是函数”
有没有办法像这样执行类型提示?
谢谢