2

// 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];

It works fine on my iphone12(iOS15.4), but it not works on another iphone12-Pro(iOS15.4)

error: *** -[__NSArrayM insertObject:atIndex:]: object cannot be nil (NSInvalidArgumentException)

How should I solve this problem? Thanks a lot!

林紫一
  • 21
  • 2

2 Answers2

0

Steps working for me :

  1. close the iOS device or simulator
  2. clean the build folder
  3. clear the derived data
  4. then open the iOS Device or simulator

you are good to go

0

Restarting iOS Device or simulator works for me

torun
  • 465
  • 1
  • 5
  • 11