小编Aar*_*You的帖子

无法使用内置 ssh 客户端从 macOS 通过 22 以外的任何端口 ssh 到远程主机

我最近将运行 Dropbear 的服务器上的 ssh 侦听端口从 22 切换到随机端口,以防止系统日志被某人强行淹没。

一切都很好,我可以使用 termux(一个可以安装软件包的 Android 终端模拟器)从 wan 端连接到服务器。

直到我尝试使用我的 MacBook ssh 进入服务器(在与我的手机相同的网络下,以前当 dropbear 在 22 上侦听时能够 ssh 进入服务器)。连接立即断开,ssh 向我抛出这个:

kex_exchange_identification: write: Broken pipe
Run Code Online (Sandbox Code Playgroud)

详细的输出并没有真正显示出任何有用的东西(而且我可以突然添加):

OpenSSH_8.1p1, LibreSSL 2.7.3
debug1: Reading configuration data /Users/my_username/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 47: Applying options for *
debug1: Connecting to remote.yhaoquan.top port 2123.
debug1: Connection established.
debug1: identity file /Users/my_username/.ssh/id_rsa type 0
debug1: identity file /Users/my_username/.ssh/id_rsa-cert type -1
debug1: identity file /Users/my_username/.ssh/id_dsa type -1
debug1: identity file …
Run Code Online (Sandbox Code Playgroud)

ssh networking

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

dequeueReusableCell 什么时候会返回 nil?

我是 iOS 编程领域的新手,最近在网上看到了一些实现的代码示例,例如:

\n
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { \n    var cell = tableView.dequeueReusableCell(withIdentifier: customCellIdentifier, for: indexPath) as? CustomCell\n    if (cell == nil) {\n        cell = CustomCell(style: UITableViewCell.CellStyle.default, reuseIdentifier: customCellIdentifier) asCustomCell\n        }\n    ...\n    }\n
Run Code Online (Sandbox Code Playgroud)\n

作者试图处理dequeueReusableCellreturn nil 的事件。

\n

dequeueReusableCell但从我对 UITableView 和自定义单元格的有限个人经验来看,我还没有遇到过返回 nil 的情况。

\n

经过研究,我发现原因可能是

\n
\n

“dequeue\xe2\x80\xa6 方法尝试查找当前位于屏幕外的具有给定重用\n标识符的单元格。如果找到,则返回\n该单元格,否则返回 nil。”

\n
\n

从 MrTJ 的回答这里

\n

但这种事从来没有发生在我身上。当我故意给它一个错误的标识符时,会发生运行时错误,但不会返回 nil 一次。我想知道这种情况到底什么时候会发生以及是否真的有必要处理它。

\n

uitableview ios swift

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

标签 统计

ios ×1

networking ×1

ssh ×1

swift ×1

uitableview ×1