2011-11-25 43 views
0

我正在調用另一個類的方法,但我無法獲取此錯誤。我搜索它,但我沒有找到任何解決方法。請幫忙。在調用另一個類的方法時拋出'NSException'錯誤實例後調用Terminate

代碼:

adres = [adres stringByAppendingString:[NSString stringWithFormat:@"%@", textArama.text]]; 

    BaseHttpPost *m_HttpDownloadSearch = [[[self class] alloc] init]; 
    [m_HttpDownloadSearch HttpPost:adres data:@""]; 

錯誤是:

2011-11-26 00:46:10.386 Sarki Sözleri[1520:207] -[Sarki_So_zleriViewController HttpPost:data:]: unrecognized selector sent to instance 0x4b6ad30 
2011-11-26 00:46:10.388 Sarki Sözleri[1520:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Sarki_So_zleriViewController HttpPost:data:]: unrecognized selector sent to instance 0x4b6ad30' 
*** Call stack at first throw: 
(
    0 CoreFoundation      0x00e315a9 __exceptionPreprocess + 185 
    1 libobjc.A.dylib      0x00f85313 objc_exception_throw + 44 
    2 CoreFoundation      0x00e330bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187 
    3 CoreFoundation      0x00da2966 ___forwarding___ + 966 
    4 CoreFoundation      0x00da2522 _CF_forwarding_prep_0 + 50 
    5 Sarki SoÃàzleri      0x0000250e -[Sarki_So_zleriViewController btnAra_click:] + 382 
    6 UIKit        0x000834fd -[UIApplication sendAction:to:from:forEvent:] + 119 
    7 UIKit        0x00113799 -[UIControl sendAction:to:forEvent:] + 67 
    8 UIKit        0x00115c2b -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527 
    9 UIKit        0x001147d8 -[UIControl touchesEnded:withEvent:] + 458 
    10 UIKit        0x000a7ded -[UIWindow _sendTouchesForEvent:] + 567 
    11 UIKit        0x00088c37 -[UIApplication sendEvent:] + 447 
    12 UIKit        0x0008df2e _UIApplicationHandleEvent + 7576 
    13 GraphicsServices     0x0130a992 PurpleEventCallback + 1550 
    14 CoreFoundation      0x00e12944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52 
    15 CoreFoundation      0x00d72cf7 __CFRunLoopDoSource1 + 215 
    16 CoreFoundation      0x00d6ff83 __CFRunLoopRun + 979 
    17 CoreFoundation      0x00d6f840 CFRunLoopRunSpecific + 208 
    18 CoreFoundation      0x00d6f761 CFRunLoopRunInMode + 97 
    19 GraphicsServices     0x013091c4 GSEventRunModal + 217 
    20 GraphicsServices     0x01309289 GSEventRun + 115 
    21 UIKit        0x00091c93 UIApplicationMain + 1160 
    22 Sarki SoÃàzleri      0x00001d09 main + 121 
    23 Sarki SoÃàzleri      0x00001c85 start + 53 
) 
terminate called after throwing an instance of 'NSException' 

請幫助我!

+0

首先通過NSZombieEnabled和Instruments檢查是否有任何殭屍對象(過度釋放對象)。這些往往會破壞記憶並創造像你一樣的例外。還可以看看您的應用程序是否在多個線程中使用了一些數據結構(例如,網絡下載回調)。這也可能導致內存損壞。 –

+0

我是新來的iphone,所以我有一個類什麼名字是BaseHttpPost,我只是想用buton點擊應用程序沒有做其他任何事情。 –

+0

運行應用程序多幾次...看看你是否得到相同的類調用'HttpPost:data:' – aopsfan

回答

1

您不應該使用[[[self class] alloc] init]。您可能需要[BaseHttpPost alloc] init]

0

-(void)HttpPost:adres data:屬於BaseHttpPost類..所以爲什麼你分配和初始化本類的一個對象,並從中調用此方法,該方法Sarki_So_zleriViewController也許視圖 - 控制從烏爾調用此方法,而BaseHttpPost有方法

相關問題