CaveOps: Night-City
#Hello Edgerunners, welcome to the Night-City.

Welcome!

SSL: certificate verify failed

今天在虚拟机里安装 CocoaPods 的时候,偶然遇到一个问题: $ gem install cocoapods ERROR: Could not find a valid gem 'cocoapods' (>= 0), here is why: Unable to download data from https://ruby.taobao.org/ - SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (...

Xcode 8: Resource fork, Finder information, or similar detritus not allowed

最近 Xcode 8 中遇到这样一个错误: .app: resource fork, Finder information, or similar detritus not allowed 其实解决办法也简单,分别进入项目的目录、DerivedData 目录执行 xattr -rc . 即可。 参考内容: https://forums.developer.apple.com/thread/48726 https://forums.developer.apple.com/thread/48905 com.apple.FinderInfo ...

Swift 3: Basic Syntax

这里是一些 Swift 3 的基本语法示例,Swift 前几个版本变化较大,所以做一个总结。 虽然目前来说选择 Swift 做为商业应用的开发语言的维护成本还是很大,但始终是一个前进的方向。 控制台输出 let con = "something" print("content: \(con)") 常量和变量 常量使用 let 声明, 变量使用 var 声明。 自动推导 let b = 10 //Int let b1 = 10.0 //Double let b2 = "" //String let b3 = true //...

Swift 3.0 怎么玩

Swift 已经发展到 3.0,早在几个月前苹果就已经表明 Swift 3.0 还将会有不少崩坏性的改动,这篇博客就来介绍一下新版本 Swift 的主要改动。 编译器与语法 参数标签 在 Swift 3.0 中的函数、方法,从第一个参数开始就必须指定参数标签,当然,你可以使用 _ 明确指出调用时省略参数。 func sum(left: Int, right: Int) -> Int { return left + right } sum(left: 1, right: 2) // 在以往的版本中你可能是这样调用的: // sum(1,2) // sum(1, right: 2)...

OS X: Simulating mouse input programmatically

玩过远程辅助工具小伙伴应该都对模拟鼠标事件不陌生, 要做到这件事, 可以使用 Quartz Event Services。 先来一个 Demo, 首先要引入 ApplicationServices: #include <ApplicationServices/ApplicationServices.h> 接下来, 要模拟事件, 首先需要创建事件: CGPoint p1 = CGPointMake(500, 500); CGPoint p2 = CGPointMake(700, 700); // Move to p1 CGEventRef move1 = CGEventCrea...

Sierra: 找回消失的允许“任何来源”的应用

自从 Sierra 之后, 系统偏好设置 -> 通用 -> 允许以下位置下载的应用 中的 任何来源 便消失了。 为了找回它,我们打开 终端, 输入: sudo spctl --master-disable 回车,输入密码,之后重新打开设置便可以看到久违的 任何来源 了。这个操作也可以解决一些来自网络的应用提示 已损坏 的问题。...

It's amazing how nice people are to you when they know you're going away.

Xcode 8: 注释快捷键失效的问题

Xcode 8 发布以来,Beta 版有一个可能不是很普遍的问题: 注释快捷键 ⌘ + / 失效。 在 Twitter 上找到一个解决办法,很简单,在终端执行下面的指令,然后重启系统即可。 sudo /usr/libexec/xpccachectl ...

User-Agents

一些常见的 User-Agents 示例: 桌面 IE Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0) Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2) Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) Mozilla/4.0 (compatible; MSIE 5.0; Windows NT) 其中,版本号是 MSIE 之后的数字。 如: MSIE 8.0 代表 IE8; Windows NT 6.1 对应操作系统 Windows...

CocoaPods: Swift Version

最近使用 CocoaPods 又出了点问题,在执行 pod trunk push 的时候,出现了 Xcode Build 错误,提示了一些关于 Swift 版本的错误。 起初尝试了配置 Xcode 项目中 Use Legacy Swift Language Version 选项,没有作用。于是更新了 CocoaPods 到最新的测试版本 1.1.0,因为新版中允许指定 Swift 版本,有两种方法: 通过 --swift-version VERSION 来指定 通过 .swift-version 文件来指定,你可以用 echo "VERSION" > .swift-version 创建...

iOS: Easy cast with _ObjectiveCBridgeable

Swift is out there for about a year and it’s a great programming language. I think that almost every iOS/OSX developer out there has already written couple of things in Swift (if you haven’t, go ahead and try, you won’t regret it, I promise). Although, we have many years of libs and frameworks built...

iOS: UIAlertController text alignment

Custom text alignment of UIAlertController: let controller = UIAlertController(title: t, message: informative, preferredStyle: type) let paragraphStyle = NSMutableParagraphStyle() paragraphStyle.alignment = alignment paragraphStyle.lineBreakMode = lineBreakMode let messageText = NSMutableAttribute...

What's this?

The Night-City version of CaveOps inspired by Cyberpunk 2077. Not finished yet.

Pinned Message

The Founder and CEO of Infeca Technology.

Developer, Designer, Blogger.

Big fan of Apple, Love of colour.

Feel free to contact me.

反曲点科技创始人和首席执行官。

开发、设计与写作皆为所长。

热爱苹果、钟情色彩。

随时恭候 垂询