问题列表 - 第289396页

`scene(_scene: UIScene, continue userActivity: NSUserActivity)` 在用户点击通用链接后启动应用程序时不会被调用

scene(_ scene: UIScene, continue userActivity: NSUserActivity)在用户单击通用链接后启动应用程序时,不会调用方法。

当用户单击通用链接后,已启动的应用程序再次打开时,它工作正常。示例代码:

func scene(_ scene: UIScene, continue userActivity: NSUserActivity) {
    guard userActivity.activityType == NSUserActivityTypeBrowsingWeb,
        let incomingURL = userActivity.webpageURL,
        let components = NSURLComponents(url: incomingURL, resolvingAgainstBaseURL: true),
        let path = components.path else {
            return
    }
    let params = components.queryItems ?? [URLQueryItem]()

    print("path = \(path)")
    print("params = \(params)")
}
Run Code Online (Sandbox Code Playgroud)

我尝试使用application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration,但是当用户单击链接时它永远不会被调用:

func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
    if let scene = …
Run Code Online (Sandbox Code Playgroud)

ios ios-universal-links ios13 uiscenedelegate uiscene

5
推荐指数
4
解决办法
2559
查看次数

ArrowKT - @optics 注释不生成代码

您如何设置箭头依赖项以使@optics注释实际工作?不会为标有 的数据类生成伴随对象@optics

如果我没记错的话,这是一个注释处理器,因此应该使用 导入它kapt,但是文档将其用作compile.

kotlin arrow-kt

2
推荐指数
1
解决办法
336
查看次数

手动设置 Flutter 验证错误

在验证表单并将请求从 flutter 发送到服务器后端后:我想将来自服务器的任何潜在错误消息设置为以原始表单显示。最好完全像验证错误。

例如:

Widget build(BuildContext context) {
...
  TextFormField(
    onFieldSubmitted: (value) => _signIn(),
    validator: (input) {
      if (input.length < 6)
        return 'Your password is too short';
      return null;
    },
    onSaved: (input) => _password = input,
    decoration: InputDecoration(
      labelText: 'Password',
    ),
    obscureText: true,
  )
...
}

Future<void> _signIn() async {
  final formState = _formKey.currentState;
  if (!formState.validate()) return;
  formState.save();

  try {
    ... // do fancy request stuff
  } catch (e) {
    // this is where I want to set the "validation" …
Run Code Online (Sandbox Code Playgroud)

forms validation error-handling dart flutter

7
推荐指数
1
解决办法
7723
查看次数

不同的语法错误在输出中隐藏行

我有一个调用的脚本compile

try:
    code = compile('3 = 3', 'test', 'exec')
except Exception as e:
    sys.stderr.write(''.join(traceback.format_exception_only(type(e), e)))
Run Code Online (Sandbox Code Playgroud)

3 = 3 结果是:

File "test", line 1
SyntaxError: can't assign to literal
Run Code Online (Sandbox Code Playgroud)

3 = 3a实际上打印行

File "test", line 1
    3 = 3a
        ^
SyntaxError: invalid syntax
Run Code Online (Sandbox Code Playgroud)

知道为什么吗?

python traceback python-3.x

1
推荐指数
1
解决办法
39
查看次数

gcc-7:错误:无法识别的命令行选项“-m64”

我正在尝试在 Jetson Nano 上编译 C 代码,但在编译过程中出现此错误。我尝试删除任何出现的 'm -64',但它似乎是自动添加的。这是 cmd 失败的地方: /usr/bin/gcc-7 -Wall -Wextra -Wconversion -pedantic -Wshadow -m64 -Wfatal-errors -O0 -g -o CMakeFiles/dir/testCCompiler.c.o -c /home/user/dir/CMakeFiles/CMakeTmp/testCCompiler.c

uname -a: Linux jetson-nano 4.9.140-tegra aarch64 aarch64 aarch64 GNU/Linux

gcc-7 -v: Using built-in specs.
COLLECT_GCC=gcc-7
COLLECT_LTO_WRAPPER=/usr/lib/gcc/aarch64-linux-gnu/7/lto-wrapper
Target: aarch64-linux-gnu
gcc version 7.4.0 (Ubuntu/Linaro 7.4.0-1ubuntu1~18.04.1)
Run Code Online (Sandbox Code Playgroud)
CMAKE_C_COMPILER = gcc-7
CMAKE_CXX_COMPILER = g++-7

CXX_COMPILE_FLAGS =  "-Wall -Werror -Wextra -Wnon-virtual-dtor -Wconversion -Wold-style-cast -pedantic -Wshadow"
C_COMPILE_FLAGS = "-Wall -Wextra -Wconversion -pedantic -Wshadow"
Run Code Online (Sandbox Code Playgroud)

gcc-7:错误:无法识别的命令行选项“-m64”

c++ linux g++ arm64 gcc7

3
推荐指数
1
解决办法
9275
查看次数

调用 CreateBucket 操作时发生错误(IllegalLocationConstraintException)

使用 aws api 我可以在 us-east-1 而不是其他区域创建一个存储桶,这是为什么?

$ aws s3api create-bucket --bucket snap2web-12 --region us-east-1
{
    "Location": "/snap2web-12"
}
19:21:27 durrantm u2018 /home/durrantm/Dropbox/_/Michael/cli_scripts 
$ aws s3api create-bucket --bucket snap2web-13 --region us-east-2

An error occurred (IllegalLocationConstraintException) when calling the CreateBucket operation: The unspecified location constraint is incompatible for the region specific endpoint this request was sent to.
19:21:44 durrantm u2018 /home/durrantm/Dropbox/_/Michael/cli_scripts 
$ aws s3api create-bucket --bucket snap2web-14 --region us-west-1

An error occurred (IllegalLocationConstraintException) when calling the CreateBucket operation: The unspecified location constraint …
Run Code Online (Sandbox Code Playgroud)

amazon-s3 amazon-web-services

2
推荐指数
1
解决办法
2940
查看次数

What is the difference between different ways of passing a function as an argument to another function?

I have the situation where one function calls one of several possible functions. This seems like a good place to pass a function as a parameter. In this Quoara answer by Zubkov there are three ways to do this.

int g(int x(int)) { return x(1); }
int g(int (*x)(int)) { return x(1); }
int g(int (&x)(int)) { return x(1); }
...
int f(int n) { return n*2; }
g(f); // all three g's above work the same
Run Code Online (Sandbox Code Playgroud)

When should which …

c++ function parameter-passing

8
推荐指数
1
解决办法
150
查看次数

Structured bindings to get consecutive elements of a sub-vector without copying

I have a std::vector<T> vec where consecutive blocks of 3 elements are of interest. For ease of processing, I'd like to extract such elements. Currently, the code looks like:

const T& a = vec[i];
const T& b = vec[i + 1];
const T& c = vec[i + 2];
Run Code Online (Sandbox Code Playgroud)

I'd like to use a structured binding to compress the extraction of a, b, c to a single line.

A simple option would be something along the lines of:

std::tuple<T, …
Run Code Online (Sandbox Code Playgroud)

c++ structured-bindings

3
推荐指数
1
解决办法
34
查看次数

Flutter:Oauth2 - 重定向 uri 的问题

我想在我的 Flutter 应用程序中设置 Spotify API 的 oAuth 身份验证。我选择了 flutter_web_auth 0.1.1 包。到目前为止,我已经设法让用户可以登录到 Spotify。登录后,用户应该被重定向回我的应用程序。那行不通。Spotify 总是将用户重定向到另一个网站,而不是返回到应用程序。用户登录后如何关闭 WebView 并将用户重定向到我的应用程序?

import 'package:flutter/material.dart';
import 'package:flutter_web_auth/flutter_web_auth.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
    authenticate();
  }

  void authenticate() async {
    // Present the dialog to the user
    final result = await FlutterWebAuth.authenticate(
      url:
          "https://accounts.spotify.com/de/authorize?client_id=78ca499b2577406ba7c364d1682b4a6c&response_type=code&redirect_uri=https://partyai/callback&scope=user-read-private%20user-read-email&state=34fFs29kd09",
      callbackUrlScheme: "https://partyai/callback",
    );

// Extract token from resulting url
    final token = Uri.parse(result).queryParameters['token'];
    print('token');
    print(token);
  } …
Run Code Online (Sandbox Code Playgroud)

oauth spotify oauth-2.0 flutter

1
推荐指数
2
解决办法
6896
查看次数

使用异步获取响应钩子

我是 React 钩子的新手,但我试图将 auseEffect与 a一起使用useCallback,但遇到了臭名昭著的React Hook "useList" cannot be called inside a callback. React Hooks must be called in a React function component or a custom React Hook function react-hooks/rules-of-hooks错误。

Thie 文件包含 makeRequest:

function useConnections = () => {
    const makeRequest = React.useCallback(async (props) => {
        // Determine base url, determine headers here
        const response = fetch(url, options);

        return response;
    }

    return { makeRequest };
}
Run Code Online (Sandbox Code Playgroud)

这个文件是我的useListProvider

function useListProvider = () => …
Run Code Online (Sandbox Code Playgroud)

reactjs react-hooks

16
推荐指数
1
解决办法
3万
查看次数