- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我需要访问应用程序委托(delegate)中的一些值,以使用 Sparkle 修改(和测试)更新过程。所以问题是,如何在我的 UI 测试中从 XCUIApplication 访问 NSApplicationDelegate?
最佳答案
简答:
您无法从您的 UITest 项目访问您的 AppDelegate
文件。
长答案:
正如 Oletha 在 their answer here 中所述:
Xcode UI testing is designed such that the test code can only see what a user can see, so no objects from the application under test can be used or inspected in the test code. This is also why the views on the screen are represented as XCUIElement objects instead of UIView descendants.
The UI tests run in a separate executable from the application under test.
关于arrays - 如何在我的 UI 测试中从 XCUIApplication 访问 NSApplicationDelegate,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40267536/
我有一个简单的单窗口应用程序,上面有一个文件的放置目标。这很好用。但是,我还希望当它通过命令行启动时,它只是处理这些文件,而不是显示一个窗口。 NSApplicationDelegate 中是否有委托
在ApplicationDelegate.h中,我有: @interface appDelegate : NSObject - (IBAction)showPage:(id)sender; 在 bu
我正在尝试在 macOS Sierra 上的 Xcode 8(稳定版)中创建一个没有 Storyboard的 macOS 应用程序。但是,我的 AppDelegate 甚至没有启动。这是我的代码: i
我正在尝试在我的 appDelegate 类上加载一个 ViewController。像这样: class AppDelegate: NSObject, NSApplicationDelegate {
我一直在尝试使用 Swift 3,但我无法开始。以下代码正在编译,但它不记录任何内容。看起来 applicationDidFinishLaunching 没有被调用。我是否遗漏了一些关键部分? Sou
我创建了简单的 Cocoa 应用程序 (Mac OS X 10.6) 并且出现了入口点: int main(int argc, char *argv[]) { return NSApplica
我正在尝试在 macOS Sierra 上的 Xcode 8(稳定版)中创建一个没有 Storyboard的 macOS 应用程序。但是,我的 AppDelegate 甚至没有启动。这是我的代码: i
我正在将 iOS 应用程序移植到 OS X。我正在考虑使用 Apple 示例代码“AnimatedTableView”作为起点,但惊讶地发现它没有 NSApplicationDelegate。在 iO
main.m #import int main(int argc, char *argv[]) { return NSApplicationMain(argc, (const char *
我的 Swift 3、Xcode 8.2 MacOS 应用程序通过 Web 服务调用加载多个表。由于这些表由我的七个 View Controller 中的一个或多个使用,因此我将它们放置在 AppDe
我需要访问应用程序委托(delegate)中的一些值,以使用 Sparkle 修改(和测试)更新过程。所以问题是,如何在我的 UI 测试中从 XCUIApplication 访问 NSApplicat
我正在尝试使用 objc_getProtocol() 函数来获取对表示 NSApplicationDelegate 协议(protocol)的结构的引用: Protocol *protocol = o
有人可以给我举一个这个工作的例子吗?我只想通过 AppleScript 设置属性值。我已经浏览了所有可编写脚本的示例,它们的设置不同。
我有一个用 Xcode 编写的非常基本的 Cocoa 应用程序,我正在尝试使用简单的 AppleScript 脚本访问我的应用程序委托(delegate)的属性: tell application "
我正在尝试编写一个简单的 Objective-C 应用程序:我只想要一个能够在状态栏中显示单词并允许通过 AppleScript 更新该单词的应用程序。说实话,我对 AppleScript 知之甚少,
我想打开一个文件,将其拖放到应用程序图标上。当我这样做时,我的应用程序被打开,因此文件扩展名定义明确并且与我的应用程序相关。但是 application:openFile: 函数永远不会被调用。所以我
嘿!我将我的 Mac 应用程序设置为在浏览器(如 Safari)中调用 myApp://协议(protocol)启动,但当应用程序被该协议(protocol)调用时,我似乎无法执行操作。委托(dele
我有一个 Mac OS X 应用程序,它实现了 -(void)application openFiles: 方法来响应应用程序图标上的拖动文件。 我在目标信息设置的文档类型部分有一个允许的文件类型列表
我是一名优秀的程序员,十分优秀!