ios - waitForExpectationsWithTimeout crashes -


i trying test asynchronous request xctest , using expectationwithdescription:. yet when waitforexpectationswithtimeout called crashes without waiting timeout. tried putting fulfill operation after exclude timeout issue, di no change things; function:

func testtrafficrefresh(){     let expectation = expectationwithdescription("refreshed")     waitforexpectationswithtimeout(10, handler:nil)     traffic.trafficrefresh {[weak self] () -> void in         let coming=inarrivohddetailviewcontroller.shareddetailcontroller().activetransit         let buses=self!.traffic.arrivingbuses         let count=buses.count         xctassert(count==0 && coming==0, "no buses , active transit")         xctassert(count>0 && coming==1, "arriving buses , inactive transit")         expectation.fulfill()        } } 

the same behavior happens in other functions. if take away waitforexpectationswithtimeout operation , keep expectationwithdescription operation, crashes @ end of function. in both case crash repot following:

libsystem_kernel.dylib`__pthread_kill: 0x10723227c <+0>:  movl   $0x2000148, %eax 0x107232281 <+5>:  movq   %rcx, %r10 0x107232284 <+8>:  syscall  0x107232286 <+10>: jae    0x107232290               ; <+20> 0x107232288 <+12>: movq   %rax, %rdi 0x10723228b <+15>: jmp    0x10722dc53               ; cerror_nocancel 0x107232290 <+20>: retq    0x107232291 <+21>: nop     0x107232292 <+22>: nop     0x107232293 <+23>: nop 

you can try provide implementation handler. per docs handler parameter not optional in waitforexpectationswithtimeout markup:

func waitforexpectationswithtimeout(timeout: nstimeinterval, handler handlerornil: xcwaitcompletionhandler!) 

therefore can try provide explicity unwrapped handler(even empty 1 job):

    waitforexpectationswithtimeout(10) { error in         //xctassertnil(error, "") optional     } 

also try follow this post , see whether more appropriate crash log.


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -