sammcewan / WYPopoverController

WYPopoverController is for the presentation of content in popover on iPhone / iPad devices. Very customizable.
Other
252 stars 74 forks source link

KIF compatibility #52

Open maciekish opened 9 years ago

maciekish commented 9 years ago

Hi, I'm trying to use WYPopoverController together with KIF tests. Unfortunately it crashes when trying to display a popover. I'm trying to run this on the iPad 2 iOS 8.1 simulator. If i just hit ⌘R and tap the UI element that causes a popover to appear, it works perfectly. But if i press ⌘Uto run the tests and tap the search bar it crashes. I also tried manually tapping the search bar before KIF takes any actions (by making KIF wait using [tester waitForTimeInterval:60]) and it crashes then as well, so at least we can rule out KIF tapping the wrong element or tapping it in the wrong way.

It crashes on [_inView.window addSubview:_backgroundView];

Full backtrace:

<unknown>:0: error: -[HITDirectSearchTests testDirectHit0702011***] : failed: caught "NSInvalidArgumentException", "*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil"
(
    0   CoreFoundation                      0x04a25946 __exceptionPreprocess + 182
    1   libobjc.A.dylib                     0x0433ea97 objc_exception_throw + 44
    2   CoreFoundation                      0x048dcc01 -[__NSArrayM insertObject:atIndex:] + 881
    3   CoreFoundation                      0x048dc861 -[__NSArrayM addObject:] + 65
    4   UIKit                               0x0311535c PushNextClassForSettingIMP + 383
    5   UIKit                               0x03115149 __workaround10030904InvokeWithTarget_block_invoke + 29
    6   UIKit                               0x02b67f05 +[UIView _performCustomizableAppearanceModifications:] + 29
    7   UIKit                               0x03115121 workaround10030904InvokeWithTarget + 1047
    8   UIKit                               0x0310ee05 +[_UIAppearance _applyInvocationsTo:window:matchingSelector:] + 4248
    9   UIKit                               0x0310f624 +[_UIAppearance _applyInvocationsTo:window:] + 56
    10  UIKit                               0x02b836f5 -[UIView(Internal) _applyAppearanceInvocations] + 287
    11  UIKit                               0x02b84139 __88-[UIView(Internal) _performUpdatesForPossibleChangesOfIdiom:orScreen:traverseHierarchy:]_block_invoke + 65
    12  UIKit                               0x02b840c6 -[UIView(Internal) _performUpdatesForPossibleChangesOfIdiom:orScreen:traverseHierarchy:] + 204
    13  UIKit                               0x02b83ff3 -[UIView(Internal) _didChangeFromIdiom:onScreen:traverseHierarchy:] + 57
    14  UIKit                               0x02b83fb2 -[UIView(Internal) _didChangeFromIdiomOnScreen:traverseHierarchy:] + 172
    15  UIKit                               0x02b835a7 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 1685
    16  UIKit                               0x02b7a517 __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 154
    17  UIKit                               0x02b7a475 -[UIView(Hierarchy) _postMovedFromSuperview:] + 458
    18  UIKit                               0x02b85f0d -[UIView(Internal) _addSubview:positioned:relativeTo:] + 2018
    19  UIKit                               0x02b7886e -[UIView(Hierarchy) addSubview:] + 56
    20  hitta.se                            0x0054099a -[WYPopoverController presentPopoverFromRect:inView:permittedArrowDirections:animated:options:completion:] + 2650
    21  hitta.se                            0x005425a7 -[WYPopoverController presentPopoverFromBarButtonItem:permittedArrowDirections:animated:options:completion:] + 519
    22  hitta.se                            0x0054227b -[WYPopoverController presentPopoverFromBarButtonItem:permittedArrowDirections:animated:completion:] + 219
    23  hitta.se                            0x00542185 -[WYPopoverController presentPopoverFromBarButtonItem:permittedArrowDirections:animated:] + 149
    24  hitta.se                            0x00161cbe -[HITSearchViewController showFavoritePopover] + 670
    25  hitta.se                            0x00161a12 -[HITSearchViewController openFavoriteView] + 306
    26  libobjc.A.dylib                     0x043547cd -[NSObject performSelector:withObject:withObject:] + 84
    27  UIKit                               0x02aff23d -[UIApplication sendAction:to:from:forEvent:] + 99
    28  UIKit                               0x02e6f840 -[UIBarButtonItem(UIInternal) _sendAction:withEvent:] + 139
    29  libobjc.A.dylib                     0x043547cd -[NSObject performSelector:withObject:withObject:] + 84
    30  UIKit                               0x02aff23d -[UIApplication sendAction:to:from:forEvent:] + 99
    31  UIKit                               0x02aff1cf -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 64
    32  UIKit                               0x02c32e86 -[UIControl sendAction:to:forEvent:] + 69
    33  UIKit                               0x02c332a3 -[UIControl _sendActionsForEvents:withEvent:] + 598
    34  UIKit                               0x02c3250d -[UIControl touchesEnded:withEvent:] + 660
    35  UIKit                               0x02b4f60a -[UIWindow _sendTouchesForEvent:] + 874
    36  UIKit                               0x02b500e5 -[UIWindow sendEvent:] + 791
    37  UIKit                               0x02b15549 -[UIApplication sendEvent:] + 242
    38  UIKit                               0x02b2537e _UIApplicationHandleEventFromQueueEvent + 20690
    39  UIKit                               0x02af9b19 _UIApplicationHandleEventQueue + 2206
    40  CoreFoundation                      0x049491df __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
    41  CoreFoundation                      0x0493eced __CFRunLoopDoSources0 + 253
    42  CoreFoundation                      0x0493e248 __CFRunLoopRun + 952
    43  CoreFoundation                      0x0493dbcb CFRunLoopRunSpecific + 443
    44  CoreFoundation                      0x0493d9fb CFRunLoopRunInMode + 123
    45  hitta.se Tests                      0x108d81cd -[KIFTestActor tryRunningBlock:complete:timeout:error:] + 461
    46  hitta.se Tests                      0x108d8456 -[KIFTestActor runBlock:complete:timeout:] + 182
    47  hitta.se Tests                      0x108d868b -[KIFTestActor runBlock:timeout:] + 139
    48  hitta.se Tests                      0x108d8bf9 -[KIFTestActor waitForTimeInterval:] + 233
    49  hitta.se Tests                      0x10540333 -[HITDirectSearchTests setUp] + 403
    50  XCTest                              0x201088e8 -[XCTestCase invokeTest] + 173
    51  XCTest                              0x20108bb9 -[XCTestCase performTest:] + 184
    52  XCTest                              0x20114162 -[XCTest run] + 314
    53  XCTest                              0x20107598 -[XCTestSuite performTest:] + 406
    54  XCTest                              0x20114162 -[XCTest run] + 314
    55  XCTest                              0x20107598 -[XCTestSuite performTest:] + 406
    56  XCTest                              0x20114162 -[XCTest run] + 314
    57  XCTest                              0x20107598 -[XCTestSuite performTest:] + 406
    58  XCTest                              0x20114162 -[XCTest run] + 314
    59  XCTest                              0x20103de2 __25-[XCTestDriver _runSuite]_block_invoke + 61
    60  XCTest                              0x20110c82 -[XCTestObservationCenter _observeTestExecutionForBlock:] + 184
    61  XCTest                              0x20103d06 -[XCTestDriver _runSuite] + 285
    62  XCTest                              0x20104951 -[XCTestDriver _checkForTestManager] + 272
    63  XCTest                              0x20104c6b -[XCTestDriver runTestSuite:completionHandler:] + 378
    64  XCTest                              0x2011775c +[XCTestProbe runTests:] + 216
    65  Foundation                          0x01b3fb57 __NSFireDelayedPerform + 423
    66  CoreFoundation                      0x0497f8d6 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 22
    67  CoreFoundation                      0x0497f25d __CFRunLoopDoTimer + 1309
    68  CoreFoundation                      0x0493e6ba __CFRunLoopRun + 2090
    69  CoreFoundation                      0x0493dbcb CFRunLoopRunSpecific + 443
    70  CoreFoundation                      0x0493d9fb CFRunLoopRunInMode + 123
    71  GraphicsServices                    0x0717624f GSEventRunModal + 192
    72  GraphicsServices                    0x0717608c GSEventRun + 104
    73  UIKit                               0x02afd8b6 UIApplicationMain + 1526
    74  hitta.se                            0x001b5d07 main + 167
    75  libdyld.dylib                       0x056a9ac9 start + 1
)
sammcewan commented 9 years ago

Normally this sort of issue arises due to swizzling that KIF is doing under the surface. It's not a library that we use on any of the projects I'm working on. Were you able to resolve this?

maciekish commented 9 years ago

Unfortunately no, the issue remains. Any idea about what to try please?

vitalys commented 9 years ago

@maciekish could you provide simple test project that reproduces the problem? Otherwise a chance to get this problem fixed really small.