Jun
28
OS X: Menu Bar Extra is invisible in macOS Dark Mode
Published 12:06 Jun 28, 2016 by @ezra.
#Programming# 周末提交的 APP 又被秒拒, 理由很简单, “Menu Bar Extra is invisible in macOS Dark Mode”, 菜单栏图标在黑色模式中看不到。
由于是第一次用黑白色的...
Jun
01
OS X: csrutil
Published 12:06 Jun 01, 2016 by @ezra.
#Programming# El Capitan 加入了 Rootless 机制, 不再能够随心所欲的读写很多路径真是很难过。
Rootless 机制将成为对抗恶意程序的最后防线
要关闭 Rootless, 需要进入恢复系统...
May
10
Cocoa: Change Cursor
Published 12:05 May 10, 2016 by @ezra.
#Programming# The way to change the cursor when it's over an NSButton:
First, you should subclass NSButton first,...
Apr
27
Cocoa: Sending mail via Python
Published 12:04 Apr 27, 2016 by @ezra.
#Programming# 偶然看到一个讨论, 需求很简单, 单纯的 SMTP 邮件发送。
这样的话我想 Python 应该是一个不错的选择, 那么首先我们需要写一个 Python 程序, 我们将它保存为 mail.py:
im...
Apr
25
Sparkle 2: Publishing an update
Published 12:04 Apr 25, 2016 by @ezra.
#Programming# 配置好一些基本的内容后,是时候发布一个新版本了。
归档
首先你需要归档你的应用。
如果你使用 DMG,归档后不要再次压缩 .dmg 文件
如果你使用 ZIP,你可以通过 ditto -c -k --...
Apr
25
Sparkle 1: Setup
Published 12:04 Apr 25, 2016 by @ezra.
#Programming# 做 Mac 开发的同学应该至少都听说过 Sparkle,一个应用升级框架,Sparkle 是开源的,参考 Github。
不过需要注意的是,Sparkle 的使用场景应仅仅局限于 非 App Sto...
Apr
22
NSImage: Get size in pixels
Published 12:04 Apr 22, 2016 by @ezra.
#Programming# Just simple:
let rep = originImage.representations.first
let pixelSize = CGSize(width: (rep?.pixelsW...
Apr
12
OS X: How to get the path of Home directory
Published 12:04 Apr 12, 2016 by @ezra.
#Programming# We all know that NSHomeDirectory() is retuning the sandbox root (not the home directory), [@"~" str...
Apr
11
OS X: launchd
Published 12:04 Apr 11, 2016 by @ezra.
#Programming# I would like to create a service to execute a task automatically, and starting and stopping it on de...
Mar
21
Make .webloc
Published 12:03 Mar 21, 2016 by @ezra.
#Programming# 熟悉 Mac 的同学对 .webloc 想必也不陌生, 它的实质其实就是一个 plist 文件, 也就是 XML 格式。今天刚好用到, 随手写一篇吧。
<?xml version="1...
Jan
01
What is System Integrity Protection (aka Rootless) and how to disable it
Published 12:01 Jan 01, 2016 by @ezra.
#Programming# All Macs with OS X El Capitan installed on them have a new layer of security known as System Integri...
Nov
10
OS X: Launch At Login
Published 12:11 Nov 10, 2015 by @ezra.
#Programming# To have the app launch start at login you just need to call SMLoginItemSetEnabled with your bundle I...