小编Mah*_*asi的帖子

Swift版本冲突:编译器不支持该SDK,请选择与SDK匹配的工具链

我正在使用 xCode 13.1 和 macOS 12.0.1 Monterey。KingFisher我在我的 Pod 中添加和删除了它。但我的项目不再建立了。我的本地 SDK 之一收到此错误:

Failed to build module 'CbSdk';
this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 5.4
(swiftlang-1205.0.26.9 clang-1205.0.19.55)', while this compiler is 'Apple Swift version 5.5.1 
(swiftlang-1300.0.31.4 clang-1300.0.29.6)'). Please select a toolchain which matches the SDK.
Run Code Online (Sandbox Code Playgroud)

我已经做了但没有成功的事情:

  • pod deintegratepod install
  • 重新启动 xCode 并清除缓存和DerivedData.
  • 签出以前有效的旧分支并提交。
  • 将代码移至另一台之前可以运行的 MacBook 上。
  • 下载、安装并选择工具链 5.4(出现奇怪的错误 -> )
  • 将我的目标和项目的 swift 编译器语言更改为 swift 4 …

xcode conflict cocoapods swift

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

使用 PKCS10 创建 CSR 并在 Swift 中使用 RSA 密钥进行签名

我生成了RSA密钥,我的后端发送了 3 个参数BASE64(签名算法除外)以供CSR我创建:

"subject" : "MIGfMQswCQYDVQQGEwJJUjEvMC0GA1UEAwwmMTAwMDAwMzg1MDA3NjAxMy3YqNmH2LLYp9ivINi12KfYr9mC24wxGTAXBgNVBAUTEDEwMDAwMDM4NTAwNzYwMTMxEzARBgNVBCoMCtio2YfYstin2K8xEzARBgNVBAQMCti12KfYr9mC24wxGjAYBgkqhkiG9w0BCQEWC2luZm9AdWlkLmly",
"extensions" : "MDMwDgYDVR0PAQH/BAQDAgXgMBYGA1UdJQEB/wQMMAoGCCsGAQUFBwMCMAkGA1UdEQQCMAA="
"signatureAlgorithm" : "SHA256_WITH_RSA"
Run Code Online (Sandbox Code Playgroud)

我在 Android/java 中有用于BouncyCastle执行此操作的示例代码:

byte[] subjectBytes = EncodingUtils.decode(receivedSubject);
byte[] extensionsBytes = EncodingUtils.decode(receivedExtensions);

X500Name subject = X500Name.getInstance(ASN1Primitive.fromByteArray(subjectBytes));
Extensions extensions = Extensions.getInstance(ASN1Primitive.fromByteArray(extensionsBytes));

PKCS10CertificationRequestBuilder p10Builder = new JcaPKCS10CertificationRequestBuilder(subject, publicKey);

if (extensions != null)
    p10Builder.addAttribute(PKCSObjectIdentifiers.pkcs_9_at_extensionRequest, extensions);

ContentSigner signer = new ContentSigner() {

    final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();

    @Override
    public AlgorithmIdentifier getAlgorithmIdentifier() {
        return new DefaultSignatureAlgorithmIdentifierFinder()
                .find(receivedAlgorithm);
    }

    @Override
    public OutputStream getOutputStream() {
        return this.outputStream; …
Run Code Online (Sandbox Code Playgroud)

bouncycastle asn.1 csr swift pkcs#10

10
推荐指数
0
解决办法
453
查看次数

addArrangedSubview vs addSubview

I'm newbie and I've wrote a customView inherited from StackView and I created a button programmatically with few attributes and when I add it to my custom view, I have two problems:

  1. If I use addArrangedSubview(myBtn), my view ignores attributes that I added and fills the whole width. But if I use addSubView(myBtn), It's ok(a blue square in 44x44)
  2. If I use addArrangedSubview(myBtn), addTarget() not works and myBtn is not clickable, but when I use addSubView(myBtn), …

xcode ios swift uistackview

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

如何从openfire获取每个对话的最后消息(每个JID)?

我正在开发一个带有SMACK库的Android上的即时消息应用程序,它使用OPENFIRE作为xmpp服务器.我想从MONFCORING SERVICE插件(基于XEP-0313)启用的openfire服务器中的MessageArchiveManager获取每个会话的最后一条消息.我知道mamManager.queryArchive()可以获取与特定jid相关的消息,或者可以获取服务器中存在的特定数量的消息(没有自定义的sepration),但我们认为smack不知道哪些JID有对话服务器!一个解决方案是每个ROSTER条目发送请求,但是当它包含大量联系人时,它的成本很高,而且我们可能会与Roster中的任何人进行对话.有没有办法或插件或其他扩展来做到这一点?

xmpp openfire archiving smack

7
推荐指数
0
解决办法
232
查看次数

Timber 库究竟是做什么的?

我听说过Timber并且正在阅读 github README,但它悄悄地让我感到困惑。

行为是通过 Tree 实例添加的。您可以通过调用 Timber.plant 安装实例。应尽早安装树木。应用程序的 onCreate 是最合乎逻辑的选择。

什么行为?

这是一个带有小型、可扩展 API 的记录器,它在 Android 的普通 Log 类之上提供实用程序。

它在 Android 的日志之上还提供了什么?

DebugTree 实现将自动确定它是从哪个类调用的,并使用该类名作为其标记。由于标签各不相同,当与像 Pidcat 这样的日志阅读器结合使用时,它的效果非常好。

什么是调试树?

默认情况下没有安装 Tree 实现,因为每次登录生产时,都会有一只小狗死去。

再次,什么是树实现?它有什么作用?我如何停止杀死小狗?

两个简单的步骤:

在应用程序类的 onCreate 中安装所需的任何 Tree 实例。

在整个应用程序中随处调用 Timber 的静态方法。

完成什么的两个简单步骤?

这些都没有在自述文件中解释。对于已经知道它是什么的人来说,这几乎是一个描述:/

android timber-android

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

将 asset 文件夹保留在 proguard Android 中

我正在使用proguard来混淆我的代码,并且我有一个称为库的模块,在该模块中我有一个资产文件夹,并且我保留了一些在运行时使用的 jar。我想将该资产文件夹保留在混淆器中。

这是它的结构:

在此输入图像描述

我怎样才能保留这些?或者我们如何在ProGuard中传递文件的路径?

android proguard android-r8

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

为什么在会话中不存在会话的情况下,openfire用户仍保持在线状态

我正在开发使用OpenFire作为XMPP服务器并使用Smack for android客户端的包含“消息”的android应用。所有功能都可以正常工作,但是当用户在线时(如您在openfire的管理面板中看到的状态),并且网络连接突然断开,它的会话将被破坏,但用户仍在服务器中处于联机状态!因此,数据包不会作为脱机消息存储在服务器中,即使用户处于脱机状态,也会将其发送给用户,并且数据包将会丢失!我已经测试过Windows客户端(Spark),但是当它的连接断开时,服务器中的会话将被破坏,用户将立即变为OFFLINE!我该怎么做才能解决这个问题? 用户1在线 但没有会议

android xmpp openfire smack server

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

tools:targetApi =“ m”的用法是什么?

clearText在Android客户端和服务器using之间有一个应用用途Retrofit,并且Android 9+不允许使用clearText

要忽略我android:usesCleartextTraffic="true"Manifest其中添加的内容 ,但会发出警告: tools:ignore="GoogleAppIndexingWarning"并建议添加tools:targetApi="m"

这有点令人困惑:

  • tools:targetApi="m"意味着任何属性与tools:是棉花糖和更高?

  • 是使用此版本的清单还是其他?这在我的应用程序中犯了不必要的错误吗?

我的清单:

...
<application
    android:name=".ApplicationClass"
    android:allowBackup="true"
    android:fullBackupContent="false"
    android:hardwareAccelerated="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="false"
    android:theme="@style/AppTheme.NoActionBar"
    android:usesCleartextTraffic="true"
    tools:ignore="GoogleAppIndexingWarning"
    tools:targetApi="m">
    ...
Run Code Online (Sandbox Code Playgroud)

android attributes namespaces manifest android-manifest

5
推荐指数
2
解决办法
1461
查看次数

使用Flutter'文件',读取lib目录中的txt文件的正确路径是什么?

我正在使用 flutter“文件”,尝试读取txtlib 目录中的文件,但我不知道应该如何编写代码来读取该文件。我也不知道我是否将该txt文件放在正确的位置,这意味着我不知道是否可以读取 lib 目录中的文件。

我已经在lib目录中放置了一个txt文件,其他dart文件也放置在该目录中。words.txt

下面是我尝试读取“word.txt”文件的代码:

Future<String> readFile() async {
  var text;
  try {
    final directory = await getApplicationDocumentsDirectory();
    print(directory.path);

    final file = File('${directory.path}/lib/words.txt');
    text = await file.readAsString();
    return text;
  } catch (e) {
    print(e.message);
  }
}
Run Code Online (Sandbox Code Playgroud)

PS我已经导入了“dart:io”和“path_provider.dart”。

当我运行该程序时,我可以看到directory.path打印在控制台中,但是e.message“无法打开文件”打印在控制台中。

我认为错误来自 'File('${directory.path}/lib/words.txt')',所以我想知道我应该如何编写代码来读取 lib 目录中的 txt 文件。

谢谢。

android flutter

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

如何更改 aws cli 中的默认配置文件变量?

我尝试将 aws cli 与 docker 镜像一起使用。

命令行如下:

slu@machine:/c/work/dfsi$ export AWS_PROFILE=role-development
slu@machine:/c/work/dfsi$ aws ecr get-login
Run Code Online (Sandbox Code Playgroud)

发生错误

(AccessDeniedException) 调用 GetAuthorizationToken 操作时:用户:arn:aws:iam::XXXXXXXXXXXX:user/slu 无权在资源上执行:ecr:GetAuthorizationToken:*

但我可以做:

aws ecr get-login --profile=role-development
Run Code Online (Sandbox Code Playgroud)

我想做的不是明显地写--profile并尝试用隐藏来做到这一点--profile variable

怎么做?

variables amazon-web-services aws-cli

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