标签: macos-catalina

带有枚举源的 SwiftUI 选择器未启用

我正在尝试了解新的 SwiftUI 选择器样式,尤其是来自数组以外的来源的数据。我已经构建了一个带有枚举的选择器。我首先制作了一个只有选择器和关联枚举的简单应用程序。这按预期工作。

奇怪的是,当我将该代码复制并粘贴到另一个带有表单中其他控件的应用程序中时,选择器似乎处于非活动状态。我看到了,但不能点击它。

这是第一个应用程序(选择器工作):

struct ContentView: View {

    @State private var selectedVegetable = VegetableList.asparagus

    var body: some View {
        NavigationView {
            Form {
                Section {
                    Picker(selection: $selectedVegetable, label: Text("My Vegetables")) {
                        ForEach(VegetableList.allCases) { v in
                            Text(v.name).tag(v)
                            //use of tag makes no difference
                        }
                    }
                }
            }
            .navigationBarTitle("Picker with Enum")
        }
    }
}

enum VegetableList: CaseIterable, Hashable, Identifiable {
    case asparagus
    case celery
    case shallots
    case cucumbers

    var name: String {
        return "\(self)".map {
            $0.isUppercase ? " \($0)" : "\($0)" …
Run Code Online (Sandbox Code Playgroud)

xcode uipickerview swiftui macos-catalina

14
推荐指数
1
解决办法
6736
查看次数

在 macOS Catalina 上安装 CommandLineTools 时 Homebrew 安装程序挂起

我正在尝试将 Homebrew 安装到 Intel MacBookPro (macOS Catalina) 上,但/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" 在终端中运行时,它似乎在安装 CommandLineTools 时挂起(它挂起的具体行是==> /usr/bin/sudo /usr/bin/touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress)。

我已经在这台机器上完整安装了 Xcode 11(据我所知,它安装了 Xcode CommandLineTools)。

导航到 /tmp 后,我发现它确实成功运行touch并创建了它运行的命令中描述的文件,但从未向其中写入任何内容。

我等了大约一个小时也没有结果。这是日志:

==> Checking for `sudo` access (which may request your password)...
Password:
==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew
==> The following existing directories will be made group writable:
/usr/local/bin
/usr/local/lib
==> The following existing directories will have their owner set to (redacted for privacy): …
Run Code Online (Sandbox Code Playgroud)

macos homebrew macos-catalina

14
推荐指数
2
解决办法
2万
查看次数

在macOS Catalina上检测屏幕录制设置

检测用户是否已启用此API的可靠方法是什么?

CGWindowListCreateImage即使禁用了屏幕录制API,也将返回有效对象。可能有多种组合(kCGWindowListOptionIncludingWindowkCGWindowListOptionOnScreenBelowWindow),只有一些组合会返回NULL。

- (CGImageRef)createScreenshotImage
{
    NSWindow *window = [[self view] window];
    NSRect rect = [window frame];

    rect.origin.y = NSHeight([[window screen] frame]) - NSMaxY([window frame]);
    CGImageRef screenshot = CGWindowListCreateImage(
                                                    rect,
                                                    kCGWindowListOptionIncludingWindow,
                                                    //kCGWindowListOptionOnScreenBelowWindow,
                                                    0,//(CGWindowID)[window windowNumber],
                                                    kCGWindowImageBoundsIgnoreFraming);//kCGWindowImageDefault
    return screenshot;
}
Run Code Online (Sandbox Code Playgroud)

唯一可靠的方法是CGDisplayStreamCreate冒险,因为Apple每年都会更改隐私设置。

   - (BOOL)canRecordScreen
    {
        if (@available(macOS 10.15, *)) {
            CGDisplayStreamRef stream = CGDisplayStreamCreate(CGMainDisplayID(), 1, 1, kCVPixelFormatType_32BGRA, nil, ^(CGDisplayStreamFrameStatus status, uint64_t displayTime, IOSurfaceRef frameSurface, CGDisplayStreamUpdateRef updateRef) {
                ;
            });
            BOOL canRecord = stream != NULL;
            if (stream) …
Run Code Online (Sandbox Code Playgroud)

macos cocoa screen-recording macos-catalina

13
推荐指数
2
解决办法
3491
查看次数

Apache 在 macOS Catalina 上拒绝访问

我的 Macbook 上运行着 Apache 网络服务器(Apple 提供的网络服务器)并且运行完美无缺,直到我升级到 Catalina 10.15。我使用了相同的 httpd.conf,但现在它正在显示

您无权访问此资源。服务器无法读取 htaccess 文件,拒绝访问以确保安全

我认为是 Catalina 访问文件夹,但我不知道如何让 Apache 访问 Web 根文件夹(位于我的 /Users/me/Documents 文件夹中),因为 Apache 不是普通的 /Application。

当我检查 lsof -nP -i4TCP:80 时,端口 80 已打开 | grep LISTEN op nmap,所以 Apache 确实启动了。

我在根文件夹中设置了一个简单的 index.html,但问题仍然存在。当我从 Apache 根文件夹中删除 .htaccess 时,我得到:

您无权访问此资源。

此外,在尝试使用 ErrorDocument 处理请求时遇到 403 Forbidden 错误。

这里有什么问题?

apache macos macos-catalina

13
推荐指数
2
解决办法
9757
查看次数

MacOs Catalina 10.15.5 崩溃并且报告没有提供任何线索

我最近将我的 MacOs 从 Catalina 10.15.4 更新到 10.15.5 (19F101)。我使用 Android Studio 作为 IDE 使用 Java 编程语言开发 Android 应用程序。所以我也更新了 Android Studio 到 v4.0 和 Java 到 8u251。

我以前从未遇到过这个错误,但是,现在我每天至少让系统崩溃一次。我无法从下面的报告详细信息中了解导致崩溃的原因,我只看到了 java 一词:

panic(cpu 1 caller 0xffffff801524aa3a): Kernel trap at 0xffffff7f980dfbcb, type 14=page fault, registers:
CR0: 0x000000008001003b, CR2: 0x0000000000000000, CR3: 0x00000001ca6f90e2, CR4: 0x00000000003626e0
RAX: 0x013050217a000004, RBX: 0xffffff802dd55800, RCX: 0x000024980000000a, RDX: 0xffffff8104098000
RSP: 0xffffff9149053930, RBP: 0xffffff9149053960, RSI: 0x000000000000000a, RDI: 0xffffff802a335000
R8:  0x0000000000000000, R9:  0x0000000000000000, R10: 0x0000020000011000, R11: 0x0000000001a8000e
R12: 0xffffff81076f6030, R13: 0x0000000000000000, R14: 0xffffff802dd55e50, R15: 0x0000000000000000 …
Run Code Online (Sandbox Code Playgroud)

java macos android-studio macos-catalina

13
推荐指数
1
解决办法
2736
查看次数

自定义字体未在 Xcode 11 (macOS Catalina) 上显示

我在下拉菜单中加载自定义字体以在故事板中选择字体时遇到问题,我有 poppins 字体和 MarvinVisionsBig。我已经将它们添加为目标成员、捆绑资源并将它们添加到 plist 并且它们已经安装在系统中。我尝试了一切,但似乎没有任何效果。

使用它来显示字体时会打印字体:

for family: String in UIFont.familyNames {
    print(family)
    for names: String in UIFont.fontNames(forFamilyName: family) {
        print("== \(names)")
    }
}
Run Code Online (Sandbox Code Playgroud)

安慰:

在此处输入图片说明

落下:

在此处输入图片说明

字体:

在此处输入图片说明

捆绑资源:

在此处输入图片说明

列表:

在此处输入图片说明

xcode ios swift xcode11 macos-catalina

12
推荐指数
1
解决办法
3150
查看次数

无法读取桌面内容:不允许操作 ~ GIMP ~ Mac ~ MacBook ~ macOS Catalina

在最近更新到 macOS Catalina 之后,所有程序都在询问我是否为它们提供了正确的权限。不幸的是,GIMP是不是这样,每当我试图使用GIMP我打开任何文件中有以下错误Could not read the contents of Desktop. Error opening directory /Users/myuser/Desktop: Operation not permitted,或像不同的地点DownloadsDocuments等打开文件的唯一1路目前右击鼠标并Open with GIMP,它工作正常。但是这个选项是有限的,例如当想要打开很多文件时。

问题是如何在 macOS Catalina 中赋予正确的权限?

permissions macos updates gimp macos-catalina

12
推荐指数
2
解决办法
7983
查看次数

在 OSX Catalina 上安装用于 gem 安装的 Ruby 开发工具

我知道这个问题有很多例子。我已经完成了这些答案中的所有内容,但 4 小时后却一无所获。

我正在尝试在 Catalina 10.15.7 上安装 gem 并获得非常流行的

/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:467:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
Run Code Online (Sandbox Code Playgroud)

有了这个额外的背景

ERROR:  Error installing ffi:
    ERROR: Failed to build gem native extension.

    current directory: /Users/bmanica/.chefdk/gem/ruby/2.4.0/gems/ffi-1.13.1/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r ./siteconf20200925-10024-qilctf.rb extconf.rb --with-cflags\=-save-temps\=obj\ -o\ tmp/a.o
Run Code Online (Sandbox Code Playgroud)

通过调用安装时

gem install ffi  -- --with-cflags="-save-temps=obj -o tmp/a.o"
Run Code Online (Sandbox Code Playgroud)

绕过 Catalina 严格的权限规则。

我刚刚下载了 XCode 和命令行工具:

> xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to …
Run Code Online (Sandbox Code Playgroud)

ruby rubygems macos-catalina

12
推荐指数
2
解决办法
2万
查看次数

Flutter 无法运行,get_navigation 和主题错误

我实际上正在尝试运行我的应用程序,但我遇到了那个错误:

Running "flutter pub get" in riverpod_stacked_app...
Launching lib/main.dart on sdk gphone x86 arm in debug mode...
Running Gradle task 'assembleDebug'...
../../.pub-cache/hosted/pub.dartlang.org/get-3.15.0/lib/get_navigation/src/extension_navigation.dart:235:37: Error: No named parameter with the name 'shadowThemeOnly'.
    final theme = Theme.of(context, shadowThemeOnly: true);
                                    ^^^^^^^^^^^^^^^
../../development/flutter/packages/flutter/lib/src/material/theme.dart:119:20: Context: Found this candidate, but the arguments don't match.
  static ThemeData of(BuildContext context) {
                   ^^
../../.pub-cache/hosted/pub.dartlang.org/get-3.15.0/lib/get_navigation/src/extension_navigation.dart:431:43: Error: No named parameter with the name 'shadowThemeOnly'.
      theme: Theme.of(key.currentContext, shadowThemeOnly: true),
                                          ^^^^^^^^^^^^^^^
../../development/flutter/packages/flutter/lib/src/material/theme.dart:119:20: Context: Found this candidate, but the arguments don't match.
  static ThemeData of(BuildContext …
Run Code Online (Sandbox Code Playgroud)

macos android-studio flutter macos-catalina

12
推荐指数
2
解决办法
6700
查看次数

由于MacOS Catalina Beta更新,Vagrant无法挂载NFS

我最近更新到了MacOS Catalina,并从中开始了一些开发。问题是当我在终端上“无所事事”时,NFS共享文件夹无法挂载,我被迫使用rsync。但是,rsync不允许我无缝使用git进行工作。我发现发生这种情况的原因是,由于新的MacOS创建了多个卷,因此流浪汉感到困惑,“文档”中文件的根目录可能是: MacOS Disk Image

有什么方法可以将根目录设置为/ etc / exports文件中的其他内容,而不用在每次出现的问题上替换根文件?可悲的是,根目录不再只是“ / ...”,而是新MacOS中的“系统/卷/数据/ ...”,但“ /”上的所有内容均已复制,因此,流浪汉困惑于将其用作根。

尝试无业游民时,我反复收到此错误消息: Terminal Image

macos virtualbox vagrant macos-catalina

11
推荐指数
1
解决办法
2077
查看次数