使用低版本 Xcode 在新版本 iOS 上开启调试
Oct 20, 2022
一般来说,新版本 Xcode 可以在最新版本的 iOS 上调试 App。 如果旧版本 Xcode 需要在新版本的 iOS 上调试,则需要把新版本 Xcode 中的设备支持文件拷贝过来。 以下方法同样…
Swift 在调用 super.init 之前必须初始化变量
Oct 10, 2022
先看一下踩坑的代码: public class MyView: UIView { private var count = 0 public init(count: Int) { super.init(frame: .zero) self.count = count } // 重写 setFrame 方法 override public var frame: CGRect { didSet { let w = frame.width * count } } } 以上示例中,count 属性是在 super.init(frame:) 之…
C++ 11 中的原始字符串字面量(Raw String Literal)
Oct 09, 2022
C++ 11 开始增加了 UTF-16 和 UTF-32 字符串字面量,默认的字符串字面量是 UTF8,三种编码的写法如下: // UTF-8 const char *utf8_string = "abc"; const char *utf8_string2 = u8"abc"; // UTF-16 const char16_t *utf16_string = u"abc"; // UTF-32 const char32_t *utf32_string = U"abc"; 在字…
Swift 5 ABI 和 Module 的稳定性
Oct 02, 2022
Swift 5.0 开始,实现了 ABI 稳定性,意味着同样的源码,即使是使用不同版本的 Swift 编译, 编译后的程序都可以在 Swift 5 Runime 下运行,而不需要要求目标环境的 Runtime 和开发环境…
macOS 命令行工具编辑 plist 文件
Oct 01, 2022
plutil 是 macOS 下的一个命令行工具,用于编辑和处理 *.plist 格式的文件。 转换文件格式 plutil -convert xml1 ToolchainInfo.plist 文件类型说明:xml1 XML 格式,binary1 二进制格式,json JSON…
Swift Package Tools Version 的写法
Sep 30, 2022
在写 Package.swift 的时候,通常第一行是使用注释的形式指定要使用的 Swift 版本: // swift-tools-version: 5.4 我把 5.4 调整为 5.0,于是改为这样: // swift-tools-version: 5.0 没想到 Xcode 报错了: Showing Recent Messages horizontal whitespace sequence [U+0020] immediately preceding…
pfctl 简介
Sep 27, 2022
在 macOS 10.10 开始,系统防火墙工具由 ipfw 替换为了 pfctl,关于 pf 防火墙的使用手册可以参考这里: https://murusfirewall.com/Documentation/OS%20X%20PF%20Manual.pdf 开启 IP 转发功能 开启 IPv4 转发功能: $ sudo sysctl net.inet.ip.forwarding=1 net.inet.ip.forwarding: 0 -> 1 开启 IPv6…
Windows 11 安装 Microsoft Store
Sep 26, 2022
使用管理员权限打开 Power Shell,输入命令: Get-AppxPackage -allusers | Select Name, PackageFullName 列出所有微软官方的包名称,找到 Microsoft.WindowsStore 对应的完整包名称: Name PackageFullName ---- --------------- Microsoft.WindowsStore Microsoft.WindowsStore_22207.1401.1.0_arm64__8wekyb3d8bbwe 把完整包名拷贝,然后输入…
mitmproxy 入门指南
Sep 25, 2022
mitmproxy 是开源的免费的 HTTP 抓包工具。 安装 mitmproxy 下载:mitmproxy-8.1.1-osx.tar.gz 解压得到三个核心程序:mitmproxy, mitmdump, mitmweb $…
bitcode 被废弃了
Sep 24, 2022
在 Xcode 14 的发布日志中: https://developer.apple.com/documentation/xcode-release-notes/xcode-14-release-notes Apple Clang Compiler Deprecations Starting with Xcode 14, bitcode is no longer required for watchOS and tvOS applications, and the App Store no longer accepts bitcode submissions from Xcode 14. Xcode no longer builds bitcode by default and generates a warning message if a project explicitly enables bitcode: “Building with bitcode…