我想在特定的時間後只調用一次方法,因此我寫了一個如下的語句。使用NSTimer調用方法的問題?
imageAnimationTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector([self imageViewAnimation:imageViewObject]) userInfo:nil repeats:NO];
以上將不會工作。爲什麼? 它給了我一些奇怪的問題。 我如何調用和使用的NSTimer沿與發送的參數是:scheduledTimerWithTimeInterval:目標:選擇:用戶信息:重複:
#0 0x02911732 in __kill()
#1 0x02911724 in kill$UNIX2003()
#2 0x029a498d in raise()
#3 0x029baa44 in abort()
#4 0x0330bfda in __gnu_cxx::__verbose_terminate_handler()
#5 0x02ccd61c in _objc_terminate()
#6 0x0330a17a in __cxxabiv1::__terminate()
#7 0x0330a1ba in std::terminate()
#8 0x0330a2b8 in __cxa_throw()
#9 0x02ccd3d8 in objc_exception_throw()
#10 0x02bb4a5b in -[NSObject doesNotRecognizeSelector:]()
#11 0x02b31676 in ___forwarding___()
#12 0x02b30a32 in __forwarding_prep_1___()
#13 0x000055af in -[StageOneForSuspectOne imageViewAnimation:] (self=0x6182a70, _cmd=0x6fda, imageView=0x618c570) at /Users/ajm/Desktop/ProgramOne/Classes/StageOne.m:218
#14 0x0004cffd in __NSFireTimer()
#15 0x02b027dc in CFRunLoopRunSpecific()
#16 0x02b018a8 in CFRunLoopRunInMode()
#17 0x0352289d in GSEventRunModal()
#18 0x03522962 in GSEventRun()
#19 0x002d1372 in UIApplicationMain()
#20 0x000028ec in main (argc=1, argv=0xbffff074) at /Users/ajm/Desktop/DetectiveJone/main.m:14
(gdb)
我也寫同一行代替我的問題,但它仍然給我錯誤(應用程序有_kill問題)的NSTimer。 – Tirth 2010-10-04 15:17:13
@rajB,請詳細說明。 – 2010-10-04 15:18:17
我正在更新控制檯返回跟蹤錯誤。 – Tirth 2010-10-04 15:42:51