mrackwitz / MRProgress

Collection of iOS drop-in components to visualize progress
MIT License
2.55k stars 305 forks source link

Update MRProgressOverlayView.m #89

Open panupan opened 9 years ago

panupan commented 9 years ago

Was trying to run KiF UI automation tests on a project with MRProgress installed as a CocoaPod and was running into a strange exception. This seems to resolve the issue.

mrackwitz commented 9 years ago

Interesting! If this would be a public API, I would say, that has to be done, clearly, as it would make the interface more solid, but as this method is private, I have doubts why it is needed at all. This change seems to be appropriate anyway. Can you still post the stacktrace? I wouldn't mind if you redact entries from your namespace, if necessary.

panupan commented 9 years ago

Sure. I think what happened is multiple modeView are being created and added to that dialog view. I'm not quite sure why it works when running the app normally but not when running through the test bundler.

failed: caught "NSInvalidArgumentException", "*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil"
(
    0   CoreFoundation                      0x01d66946 __exceptionPreprocess + 182
    1   libobjc.A.dylib                     0x06cc9a97 objc_exception_throw + 44
    2   CoreFoundation                      0x01c1dc01 -[__NSArrayM insertObject:atIndex:] + 881
    3   CoreFoundation                      0x01c1d861 -[__NSArrayM addObject:] + 65
    4   UIKit                               0x03b0535c PushNextClassForSettingIMP + 383
    5   UIKit                               0x03b05149 __workaround10030904InvokeWithTarget_block_invoke + 29
    6   UIKit                               0x03557f05 +[UIView _performCustomizableAppearanceModifications:] + 29
    7   UIKit                               0x03b05121 workaround10030904InvokeWithTarget + 1047
    8   UIKit                               0x03afee05 +[_UIAppearance _applyInvocationsTo:window:matchingSelector:] + 4248
    9   UIKit                               0x03aff624 +[_UIAppearance _applyInvocationsTo:window:] + 56
    10  UIKit                               0x035736f5 -[UIView(Internal) _applyAppearanceInvocations] + 287
    11  UIKit                               0x03574139 __88-[UIView(Internal) _performUpdatesForPossibleChangesOfIdiom:orScreen:traverseHierarchy:]_block_invoke + 65
    12  UIKit                               0x035740c6 -[UIView(Internal) _performUpdatesForPossibleChangesOfIdiom:orScreen:traverseHierarchy:] + 204
    13  UIKit                               0x03573ff3 -[UIView(Internal) _didChangeFromIdiom:onScreen:traverseHierarchy:] + 57
    14  UIKit                               0x03573fb2 -[UIView(Internal) _didChangeFromIdiomOnScreen:traverseHierarchy:] + 172
    15  UIKit                               0x035735a7 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 1685
    16  UIKit                               0x0357323f -[UIView(Internal) _didMoveFromWindow:toWindow:] + 813
    17  UIKit                               0x0357323f -[UIView(Internal) _didMoveFromWindow:toWindow:] + 813
    18  UIKit                               0x0356a517 __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 154
    19  UIKit                               0x0356a475 -[UIView(Hierarchy) _postMovedFromSuperview:] + 458
    20  UIKit                               0x03575f0d -[UIView(Internal) _addSubview:positioned:relativeTo:] + 2018
    21  UIKit                               0x0356886e -[UIView(Hierarchy) addSubview:] + 56
    22  XYZ                              0x00839872 +[MRProgressOverlayView showOverlayAddedTo:title:mode:animated:] + 242
    23  XYZ                              0x00150393 -[SettingsViewController openRemoteContent:] + 259
    24  XYZ                              0x00151532 -[SettingsViewController privacyPolicyTap] + 242
    25  XYZ                              0x0014d370 -[SettingsViewController tableView:didSelectRowAtIndexPath:] + 2304
    26  UIKit                               0x035fd94c -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1559
    27  UIKit                               0x035fdaf7 -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 285
    28  UIKit                               0x03602df3 __38-[UITableView touchesEnded:withEvent:]_block_invoke + 43
    29  UIKit                               0x035170ce ___afterCACommitHandler_block_invoke + 15
    30  UIKit                               0x03517079 _applyBlockToCFArrayCopiedToStack + 415
    31  UIKit                               0x03516e8e _afterCACommitHandler + 545
    32  CoreFoundation                      0x01c899de __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
    33  CoreFoundation                      0x01c89920 __CFRunLoopDoObservers + 400
    34  CoreFoundation                      0x01c7f35a __CFRunLoopRun + 1226
    35  CoreFoundation                      0x01c7ebcb CFRunLoopRunSpecific + 443
    36  CoreFoundation                      0x01c7e9fb CFRunLoopRunInMode + 123
    37  UITests                             0x113f37dd -[KIFTestActor tryRunningBlock:complete:timeout:error:] + 461
    38  UITests                             0x113f3a66 -[KIFTestActor runBlock:complete:timeout:] + 182
    39  UITests                             0x113f3c9b -[KIFTestActor runBlock:timeout:] + 139
    40  UITests                             0x113f4209 -[KIFTestActor waitForTimeInterval:] + 233
    41  UITests                             0x113f9552 -[KIFUITestActor tapAccessibilityElement:inView:] + 274
    42  UITests                             0x113f93be -[KIFUITestActor tapViewWithAccessibilityLabel:value:traits:] + 334
    43  UITests                             0x113f919b -[KIFUITestActor tapViewWithAccessibilityLabel:] + 123
    44  UITests                             0x11156293 -[UISettings testPrivacyPolicy] + 179
    45  CoreFoundation                      0x01c4976d __invoking___ + 29
    46  CoreFoundation                      0x01c49618 -[NSInvocation invoke] + 360
    47  XCTest                              0x2010897b -[XCTestCase invokeTest] + 320
    48  XCTest                              0x20108bb9 -[XCTestCase performTest:] + 184
    49  XCTest                              0x20114162 -[XCTest run] + 314
    50  XCTest                              0x20107598 -[XCTestSuite performTest:] + 406
    51  XCTest                              0x20114162 -[XCTest run] + 314
    52  XCTest                              0x20107598 -[XCTestSuite performTest:] + 406
    53  XCTest                              0x20114162 -[XCTest run] + 314
    54  XCTest                              0x20107598 -[XCTestSuite performTest:] + 406
    55  XCTest                              0x20114162 -[XCTest run] + 314
    56  XCTest                              0x20103de2 __25-[XCTestDriver _runSuite]_block_invoke + 61
    57  XCTest                              0x20110c82 -[XCTestObservationCenter _observeTestExecutionForBlock:] + 184
    58  XCTest                              0x20103d06 -[XCTestDriver _runSuite] + 285
    59  XCTest                              0x20104951 -[XCTestDriver _checkForTestManager] + 272
    60  XCTest                              0x20104c6b -[XCTestDriver runTestSuite:completionHandler:] + 378
    61  XCTest                              0x2011775c +[XCTestProbe runTests:] + 216
    62  Foundation                          0x02a5cb57 __NSFireDelayedPerform + 423
    63  CoreFoundation                      0x01cc08d6 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 22
    64  CoreFoundation                      0x01cc025d __CFRunLoopDoTimer + 1309
    65  CoreFoundation                      0x01c7f6ba __CFRunLoopRun + 2090
    66  CoreFoundation                      0x01c7ebcb CFRunLoopRunSpecific + 443
    67  CoreFoundation                      0x01c7e9fb CFRunLoopRunInMode + 123
    68  GraphicsServices                    0x0848824f GSEventRunModal + 192
    69  GraphicsServices                    0x0848808c GSEventRun + 104
    70  UIKit                               0x034ed8b6 UIApplicationMain + 1526
    71  XYZ                               0x000a54e8 main + 216
    72  libdyld.dylib                       0x077dcac9 start + 1
)