xcode XCTest UI测试系统照片验证警报错误,[__NSArrayM插入对象:at索引:]:对象不能为空(NSInvalidArgumentException)

hlswsv35  于 2023-02-09  发布在  其他
关注(0)|答案(2)|浏览(137)
// tap photo auth entrance
XCUIElement *collectionView = app.collectionViews.firstMatch;
XCUIElement *authCell = [collectionView.cells elementBoundByIndex:2];
[authCell tap];
    
// springboard click allow
XCUIApplication *springboard = [[XCUIApplication alloc] initWithBundleIdentifier:@"com.apple.springboard"];
XCUIElement *button = [[springboard.alerts.firstMatch buttons] elementBoundByIndex:1];
BOOL exist = [button waitForExistenceWithTimeout:5];
XCTAssertEqual(exist, YES, @"photo auth alert not exist");
[button tap];

它在我的iPhone12(iOS15. 4)上运行良好,但在另一个iPhone12-Pro(iOS15. 4)上就不能运行了
错误:***-[__NSArrayM插入对象:位于索引:]:对象不能为空(NSInvalidArgumentException)
我该怎么解决这个问题呢?谢谢!

gev0vcfq

gev0vcfq1#

对我有效的步骤:
1.关闭iOS设备或模拟器
1.清除build文件夹
1.清除派生数据
1.然后打开iOS设备或模拟器
你可以走了

ncecgwcz

ncecgwcz2#

重新启动iOS设备或模拟器对我有效

相关问题