无法在iOS设备上运行XCTests [英] Unable to run XCTests on iOS device

查看:124
本文介绍了无法在iOS设备上运行XCTests的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近注意到我无法在iOS设备上运行测试。我试过iPhone 5和iPhone 6.两者都失败了,出现了这样的错误:

I've recently noticed that I can't run tests on my iOS devices. I've tried on both an iPhone 5 and an iPhone 6. Both fail with an error like this:

2015-07-13 12:32:26.930 MyApp[1316:735999] Error loading /private/var/mobile/Containers/Data/Application/B23BED3F-5D59-4727-9AAB-1155A3F3A8F2/tmp/MyApp Tests.xctest/MyApp Tests:  dlopen(/private/var/mobile/Containers/Data/Application/B23BED3F-5D59-4727-9AAB-1155A3F3A8F2/tmp/MyApp Tests.xctest/MyApp Tests, 262): no suitable image found.  Did find:
    /private/var/mobile/Containers/Data/Application/B23BED3F-5D59-4727-9AAB-1155A3F3A8F2/tmp/MyApp Tests.xctest/MyApp Tests: mmap() error 1 at address=0x0042C000, size=0x00099000 segment=__TEXT in Segment::map() mapping /private/var/mobile/Containers/Data/Application/B23BED3F-5D59-4727-9AAB-1155A3F3A8F2/tmp/MyApp Tests.xctest/MyApp Tests
DevToolsBundleInjection: Error loading bundle '/private/var/mobile/Containers/Data/Application/B23BED3F-5D59-4727-9AAB-1155A3F3A8F2/tmp/MyApp Tests.xctest'

我在网上发现的所有其他测试错误都是代码签名错误。这似乎不是这里的情况...

All the other test errors I've found on the net with this format are code signing errors. This doesn't appear to be the case here...

与其他类似的错误一样,测试等待一两分钟,然后失败转储如下:

As with the other errors like this, the test waits for a minute or two, and then fails with a dump like this:

* thread #1: tid = 0xb3aff, 0x33d0e474 libsystem_kernel.dylib`mach_msg_trap + 20, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  * frame #0: 0x33d0e474 libsystem_kernel.dylib`mach_msg_trap + 20
    frame #1: 0x33d0e26c libsystem_kernel.dylib`mach_msg + 40
    frame #2: 0x24fc7572 CoreFoundation`__CFRunLoopServiceMachPort + 146
    frame #3: 0x24fc5b18 CoreFoundation`__CFRunLoopRun + 1016
    frame #4: 0x24f12200 CoreFoundation`CFRunLoopRunSpecific + 476
    frame #5: 0x24f12012 CoreFoundation`CFRunLoopRunInMode + 106
    frame #6: 0x2c9e3200 GraphicsServices`GSEventRunModal + 136
    frame #7: 0x286dea08 UIKit`UIApplicationMain + 1440
    frame #8: 0x000ececc MyApp`main(argc=10, argv=0x003f0488) + 108 at main.m:16

  thread #2: tid = 0xb3b16, 0x33d0e224 libsystem_kernel.dylib`kevent64 + 24, queue = 'com.apple.libdispatch-manager'
    frame #0: 0x33d0e224 libsystem_kernel.dylib`kevent64 + 24
    frame #1: 0x33c430f0 libdispatch.dylib`_dispatch_mgr_invoke + 280
    frame #2: 0x33c37d3a libdispatch.dylib`_dispatch_mgr_thread + 38


*** Canceling tests due to timeout in Waiting for test process to check in... If you believe this error represents a bug, please attach the log file at /var/folders/yz/xbdghvnj1_7fhsrwl5v232b40000gn/T/com.apple.dt.XCTest-status/Session-2015-07-13_12:31:55-JkrDBi.log

任何想法可能会发生这种情况?

Any ideas why this might be happening?

推荐答案

所以...尽管我相信相反,但这是一个代码签名问题。在Xcode中的 test 目标(而不是产品目标)上手动设置配置文件,我的测试已经通过设备运行。

So... despite my belief to the contrary, this is a code-signing issue. Manually setting the provisioning profile on the test target (not the product target) in Xcode got my test up and running through the device.

与iOS模拟器相比,测试以新的和意外的(信号量相关的)方式失败,但这是一个完全不同的讨论。

The test fails in a new and unexpected (something semaphore-related) way compared to the iOS Simulator, but that's a whole different discussion.

希望这有助于某人。

这篇关于无法在iOS设备上运行XCTests的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆