gpt4 book ai didi

ios - Xcode 5.1/iOS 7.1 : assertion failure in BKSEventFocusManager 中的单元测试问题

转载 作者:可可西里 更新时间:2023-11-01 05:44:31 24 4
gpt4 key购买 nike

升级到 Xcode 5.1 后运行基于 XCTest 的逻辑测试时看到以下错误 - 很想知道解决方法。

2014-03-11 12:57:42.258 xctest[25605:303] deferral properties must have a 
clientID 2014-03-11 12:57:42.258 xctest[25605:303] ***
Assertion failure in -[BKSEventFocusManager
deferEventsForClientWithProperties:toClientWithProperties:],
/SourceCache/BackBoardServices_Sim/SpringBoard-2618.99.15/megatrond/BKSEventFocusManager.m:63
<unknown>:0: error: -[CSAPIErrorHandlerTests testDisplayReachabilityAlert] :
props must have a valid clientID (
0 CoreFoundation 0x00b251e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x007988e5 objc_exception_throw + 44
2 CoreFoundation 0x00b25048 +[NSException raise:format:arguments:] + 136
3 Foundation 0x000114de -[NSAssertionHandler
handleFailureInMethod:object:file:lineNumber:description:] + 116
4 BackBoardServices 0x0197fece -[BKSEventFocusManager
deferEventsForClientWithProperties:toClientWithProperties:] + 154
5 UIKit 0x07a942e1 -[UIWindow _beginKeyWindowDeferral] + 176
6 UIKit 0x07a940a7 -[UIWindow _makeKeyWindowIgnoringOldKeyWindow:] + 129
7 UIKit 0x07a9400d -[UIWindow makeKeyWindow] + 41
8 UIKit 0x07a943e2 -[UIWindow makeKeyAndVisible] + 91

最佳答案

我发现重现这个的最小情况如下

#import <XCTest/XCTest.h>

@interface DummyTest : XCTestCase

@end

@implementation DummyTest

- (void)setUp {
[super setUp];
// Put setup code here. This method is called before the invocation of each test method in the class.
}

- (void)tearDown {
// Put teardown code here. This method is called after the invocation of each test method in the class.
[super tearDown];
}

- (void)testExample {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Title"
message:@"Message"
delegate:nil
cancelButtonTitle:@"Cancel"
otherButtonTitles:nil];

// Commenting out the next row does not cause the problem
[alert show];

XCTAssertTrue(YES);
}

@end

似乎在测试中显示 UIAlertView 会导致此问题。这在 Xcode 5.0 中有效,但在 Xcode 5.1 中被破坏。

  • Xcode 5.1 版 (5B130a)
  • OSX 版本 10.9.2

如果您遇到此问题,请尝试上面的代码,看看它是否可重现

关于ios - Xcode 5.1/iOS 7.1 : assertion failure in BKSEventFocusManager 中的单元测试问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22335403/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com