在以不受支持的方式自定义 AppKit 行为时,是否有人体验过 Mac App Store 接受规则?

Has anybody experience with the Mac App Store acceptance rules when customising an AppKit behaviour in an unsupported way?

在我的 Objective-C macOS 应用程序中,我找到了一种更改 windows 标题字体的方法,将此代码插入我的 NSTitlebarAccessoryViewController:

- (void)viewWillLayout {

    NSView *superView = [[[self.view superview] superview] superview];

    for (id view in superView.subviews) {

        if ([view isKindOfClass:[NSTextField class]]) {

            NSTextField *titleLabel = view;
            NSString *title = titleLabel.stringValue;

            NSFont *font = [NSFont systemFontOfSize:12.0];

            NSAttributedString *smallTitle = [[NSAttributedString alloc] initWithString:title attributes:@{NSFontAttributeName:font}];

            titleLabel.attributedStringValue = smallTitle;
        }
    }
}

这个效果很好。你认为 Apple 会因为它属于禁止的私有 API 而认为这是不可接受的吗?感谢您的帮助。

你根本不应该这样做。 Apple 没有导出这个 API 有一个很好的理由:它希望我们的开发人员使用一致的外观来保持 OS 的外观为用户所熟悉。您应该阅读 Apple 的 Human Interface Guidelines 以了解为什么这很重要。因此,您的应用很可能会因为这种黑客攻击而被拒绝,除非您有充分的理由这样做。

我认为您的应用程序会获得批准,但我不会这样做,因为视图层次结构没有记录,即使是 iOS 的小更新也可能会发生变化。此外,不保证 NSTitlebarAccessoryViewController 中的布局是固定的,因此任何此类未来更改都可能导致奇怪的剪裁和其他人工制品,因为您的字体与原始字体不同。