在我的Web视图中,我使用CSS变量在运行时更改各种颜色,具体取决于是否启用了macOS 10.14的暗模式.那很多都很好.棘手的部分是在系统外观变化时更新颜色.
我通过观察effectiveAppearance
窗口上的属性来检测更改.该通知按预期发布,但当我更新颜色时,NSColor
仍然会给我暗模式颜色(或应用程序启动的任何模式).例如,NSColor.textColor
当我响应从暗模式到光线的切换时,仍然是白色而不是黑色.我自己的颜色资产似乎也是如此.
我应该采用不同的方式或时间来获得这些颜色吗?或者这可能是操作系统错误?
编辑:如果Web视图的有效外观名称发生更改,
我还尝试创建子类WebView
并更新我的颜色drawRect()
.第一次,即使应用程序在黑暗模式下启动,我也能获得所有浅色.之后,当我从灯光模式切换到黑暗时,我得到系统颜色的深色版本和资产目录颜色的浅色版本.
在调试器外部,切换到暗模式可以工作,但初始加载总是变为浅色.
当我在Mojave下的Xcode 10中构建我的macOS应用程序时,它会自动使我的应用程序采用暗模式.我尚未准备好为我的应用程序实现黑暗模式.
如何禁用我的应用程序的暗模式,因此在macOS下的浅色和暗色模式下都显示为aqua?
我创建了一个macOS ShareExtension,我想用它来上传图片.
我还在测试这个,所以任何请求都会发送到https://beeceptor.com.
共享扩展工作正常,一旦我运行它就显示在预览中:
我添加一些文字并点击"发布"
但是图像没有上传.这是启动后台上传的代码:
let sc_uploadURL = "https://xyz.free.beeceptor.com/api/posts" // https://beeceptor.com/console/xyz
override func didSelectPost() {
// This is called after the user selects Post. Do the upload of contentText and/or NSExtensionContext attachments.
let configName = "com.shinobicontrols.ShareAlike.BackgroundSessionConfig"
let sessionConfig = URLSessionConfiguration.background(withIdentifier: configName)
// Extensions aren't allowed their own cache disk space. Need to share with application
sessionConfig.sharedContainerIdentifier = "group.CreateDaily"
let session = URLSession(configuration: sessionConfig)
// Prepare the URL Request
let request = urlRequestWithImage(image: attachedImage, text: contentText)
// Create …
Run Code Online (Sandbox Code Playgroud) 好吧,在从High Sierra到Mojave更新macOS后,Apache与PHP停止正常工作,所以我按照本指南中的说法做了所有事情 - https://getgrav.org/blog/macos-mojave-apache-multiple-php-versions
但在那之后,仍然apache不能正常工作,有时工作,有时不工作,并且它在浏览器中说ERR_CONNECTION_REFUSED或其他错误,如404或500.
在apache日志中是:
[Tue Oct 02 15:02:23.209423 2018] [mpm_prefork:notice] [pid 14579] AH00173: SIGHUP received. Attempting to restart
[Tue Oct 02 15:02:23.255957 2018] [mpm_prefork:notice] [pid 14579] AH00163: Apache/2.4.35 (Unix) PHP/7.2.10 configured -- resuming normal operations
[Tue Oct 02 15:02:23.256008 2018] [core:notice] [pid 14579] AH00094: Command line: '/usr/local/opt/httpd/bin/httpd'
[Tue Oct 02 15:14:37.626645 2018] [mpm_prefork:notice] [pid 14579] AH00173: SIGHUP received. Attempting to restart
[Tue Oct 02 15:14:37.674603 2018] [mpm_prefork:notice] [pid 14579] AH00163: Apache/2.4.35 (Unix) PHP/7.2.10 configured -- resuming normal operations …
Run Code Online (Sandbox Code Playgroud) 在具有安全内核的mac OS +10.3上安装Virtual box可能会失败。收到此消息后:
未安装内核驱动程序(rc = -1908)
因为您必须在安全性kext列表中添加编辑器Oracle。
如果有机会,可以在“首选项”->“安全和隐私”中看到要求授权的信息。
但这不是我的情况。我想分享解决方案,因为这对我来说真的很痛苦:在此授权列表中添加Oracle编辑器。
在恢复模式(cmd + R)中重新启动Mac
然后打开一个终端并输入:
spctl kext-consent add VB5E2TV963
重新启动Mac。
VB5E2TV963
是oracle的代码。
Mojave和Virtual Box 6对我来说没关系。
我安装了:
macOS_SDK_headers_for_macOS_10.14.pkg使用此:
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
Run Code Online (Sandbox Code Playgroud)我还打开了Xcode 10并等待它安装组件.
Brew仍然给我错误:
Error: The Command Line Tools header package must be installed on Mojave.
The installer is located at:
/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
Run Code Online (Sandbox Code Playgroud)
这是brew配置
$ brew config
HOMEBREW_VERSION: 1.6.12
ORIGIN: https://github.com/Homebrew/brew
HEAD: 0aab25bdb3bfa96d8eb14a38001ff6a24587bcdd
Last commit: 8 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: bde1292d5f98949e3f566b78c05e08bd30914afe
Core tap last commit: 4 hours ago
HOMEBREW_PREFIX: /usr/local
CPU: quad-core 64-bit broadwell
Homebrew Ruby: 2.3.7 => /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
Clang: 10.0 build …
Run Code Online (Sandbox Code Playgroud) 最近,我正在更新我的软件以支持暗模式,以响应研究表明看着纸白色背景显示器对眼睛和睡眠节奏不利。有没有办法从 PHP 检测用户的浏览器和/或操作系统设置为暗模式?如何检测它设置为夜间模式(减少蓝色)?
Mojave (macOS 10.14) 很棒。
Xcode 10.0 (10A254a) 很棒。
黑暗模式很棒。
不是很好,除非我遗漏了什么,是 iOS 模拟器窗口的丑陋灰色背景(全屏时):
关于如何改变这种颜色的任何想法?
好吧,这很奇怪。我的终端(带有 zsh 的 iterm2)使用control + m
或control + shift + c
now 而不是仅退出命令control + c
。
关于为什么会发生这种情况的任何想法?谢谢!
我最近将我的 mac-os 更新为 Mojave。我正在使用 Nginx,它在我以前的操作系统上运行,但在更新到 Mojave 后,我无法启动我的 Nginx。所以我尝试再次安装它,首先,它给了我 c 编译器错误,所以我下载了 Xcode 命令行工具,它消失了。现在它给了我找不到 libxml2/libxslt 库。我尝试使用 brew 安装它,但仍然出现相同的错误。我不确定出了什么问题。
我已经使用 brew install 下载了 libxml2 和 libxslt。
我的配置脚本。
./configure \
--prefix=/opt/nginx/$NGINX_NAME_VERSION \
--pid-path=/var/run/nginx.pid \
--conf-path=/etc/nginx/$NGINX_NAME_VERSION/conf/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--lock-path=/var/lock/nginx.lock \
--http-client-body-temp-path=/var/tmp/nginx/body \
--http-fastcgi-temp-path=/var/tmp/nginx/fastcgi \
--http-proxy-temp-path=/var/tmp/nginx/proxy \
--http-scgi-temp-path=/var/tmp/nginx/scgi \
--http-uwsgi-temp-path=/var/tmp/nginx/uwsgi \
--with-debug \
--with-http_addition_module \
--with-http_dav_module \
--with-http_geoip_module \
--with-http_gzip_static_module \
--with-http_realip_module \
--with-http_stub_status_module \
--with-http_ssl_module \
--with-http_sub_module \
--with-http_xslt_module \
--with-mail \
--with-mail_ssl_module \
--with-cc-opt=-I/usr/local/opt/openssl/include \
--with-ld-opt=-L/usr/local/opt/openssl/lib \
--builddir=$NGINX_BUILD_PATH
Run Code Online (Sandbox Code Playgroud)
错误 :
checking …
Run Code Online (Sandbox Code Playgroud)