簡體   English   中英

- [NSObject(NSObject)doesNotRecognizeSelector:]調用時崩潰 - [ViewController prepareForSegue:sender:]

[英]-[NSObject(NSObject) doesNotRecognizeSelector:] crash when call -[ViewController prepareForSegue:sender:]

我正在使用Crashlytics來檢測我的應用程序中的崩潰。 我偶爾會得到以下崩潰報告。

關鍵崩潰點是 - [NSObject(NSObject)doesNotRecognizeSelector:]和MyViewController.m第596行 - [MyViewController prepareForSegue:sender:]。 我不知道日志中的問題是什么。 是否可能出現多線程問題? 我也在使用Parse SDK從Parse雲中檢索數據。 而prepareForSegue:sender:方法將在用戶點擊披露指標時調用,它應該在主線程中運行。 你能不能給我一些提示來解決這個問題。 提前致謝。

這是我如何調用prepareForSegue:sender:method。

- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath
{
    [self performSegueWithIdentifier:@"oneSegue" sender:indexPath];
}

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if ([segue.identifier isEqualToString:@"oneSegue"]) {
        NSIndexPath *indexPath = (NSIndexPath*)sender;
        OneViewController *destViewController = segue.destinationViewController;
        OneClass* oneObject = self.array[indexPath.row];
        destViewController.objectName = oneObject.name;
    }
}

prepareForSegue:sender:方法由accessoryButtonTappedForRowWithIndexPath:方法觸發。 我看不到任何其他方式來調用prepareForSegue:sender:方法。 所以我不知道為什么indexPath.row會導致異常。

Fatal Exception NSInvalidArgumentException
-[UITableViewCell row]: unrecognized selector sent to instance 0x1f8a6dd0
0    CoreFoundation  __exceptionPreprocess + 162
1    libobjc.A.dylib     objc_exception_throw + 30
2    **CoreFoundation    -[NSObject(NSObject) doesNotRecognizeSelector:] + 170**
3    CoreFoundation  ___forwarding___ + 392
4    CoreFoundation  _CF_forwarding_prep_0 + 24
5    MyApp  
MyViewController.m line 596
**-[MyViewController prepareForSegue:sender:]**
6    UIKit   -[UIStoryboardSegueTemplate _perform:] + 128
7    UIKit   -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 828
8    UIKit   -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 156
9 ...    Foundation  __NSFireDelayedPerform + 450
10   CoreFoundation  __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 14
11   CoreFoundation  __CFRunLoopDoTimer + 272
12   CoreFoundation  __CFRunLoopRun + 1232
13   CoreFoundation  CFRunLoopRunSpecific + 356
14   CoreFoundation  CFRunLoopRunInMode + 104
15   GraphicsServices    GSEventRunModal + 74
16   UIKit   UIApplicationMain + 1120
17   MyApp  
main.m line 16
main
18   libdyld.dylib   start
9 Threads
com.apple.main-thread Crashed
0 ...    libsystem_kernel.dylib  __pthread_kill + 8
1    libsystem_c.dylib   pthread_kill + 58
2    libsystem_c.dylib   abort + 94
3    libc++abi.dylib     abort_message + 74
4    libc++abi.dylib     default_terminate() + 24
5    libobjc.A.dylib     _objc_terminate() + 146
6    libc++abi.dylib     safe_handler_caller(void (*)()) + 78
7    libc++abi.dylib     std::terminate() + 19
8    libc++abi.dylib     __cxa_current_exception_type
9    libobjc.A.dylib     objc_exception_rethrow + 12
10   CoreFoundation  CFRunLoopRunSpecific + 456
11   CoreFoundation  CFRunLoopRunInMode + 104
12   GraphicsServices    GSEventRunModal + 74
13   UIKit   UIApplicationMain + 1120
14   MyApp  
main.m line 16
main
com.apple.libdispatch-manager
0 ...    libsystem_kernel.dylib  kevent64 + 24
1    libdispatch.dylib   _dispatch_mgr_invoke + 796
2    libdispatch.dylib   _dispatch_mgr_thread$VARIANT$mp + 35
WebThread
0 ...    libsystem_kernel.dylib  mach_msg_trap + 20
1    libsystem_kernel.dylib  mach_msg + 40
2    CoreFoundation  __CFRunLoopServiceMachPort + 128
3    CoreFoundation  __CFRunLoopRun + 882
4    CoreFoundation  CFRunLoopRunSpecific + 356
5    CoreFoundation  CFRunLoopRunInMode + 104
6    WebCore     RunWebThread(void*) + 444
7    libsystem_c.dylib   _pthread_start + 308
com.crashlytics.MachExceptionServer
0    libsystem_kernel.dylib  mach_msg_trap + 20
1    libsystem_kernel.dylib  mach_msg + 40
2    MyApp   CLSMachExceptionServer
3    libsystem_c.dylib   _pthread_start + 308
com.apple.NSURLConnectionLoader
0 ...    libsystem_kernel.dylib  mach_msg_trap + 20
1    libsystem_kernel.dylib  mach_msg + 40
2    CoreFoundation  __CFRunLoopServiceMachPort + 128
3    CoreFoundation  __CFRunLoopRun + 882
4    CoreFoundation  CFRunLoopRunSpecific + 356
5    CoreFoundation  CFRunLoopRunInMode + 104
6    Foundation  +[NSURLConnection(Loader) _resourceLoadLoop:] + 308
7    Foundation  __NSThread__main__ + 972
8    libsystem_c.dylib   _pthread_start + 308
Thread 5
0 ...    libsystem_kernel.dylib  mach_msg_trap + 20
1    libsystem_kernel.dylib  mach_msg + 40
2    CoreFoundation  __CFRunLoopServiceMachPort + 128
3    CoreFoundation  __CFRunLoopRun + 882
4    CoreFoundation  CFRunLoopRunSpecific + 356
5    CoreFoundation  CFRunLoopRunInMode + 104
6    Foundation  -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 254
7    Foundation  -[NSRunLoop(NSRunLoop) run] + 80
8    MyApp  
PF_AFURLConnectionOperation.m line 151
+[PF_AFURLConnectionOperation networkRequestThreadEntryPoint:]
9    Foundation  __NSThread__main__ + 972
10   libsystem_c.dylib   _pthread_start + 308
Thread 6
0 ...    libsystem_kernel.dylib  __psynch_cvwait + 24
1    libsystem_c.dylib   _pthread_cond_wait + 646
2    libsystem_c.dylib   pthread_cond_wait + 40
3    Foundation  -[NSCondition wait] + 194
4    MyApp  
PFCommandCache.m line 495
-[PFCommandCache runLoop]
5    Foundation  __NSThread__main__ + 972
6    libsystem_c.dylib   _pthread_start + 308
com.apple.CFSocket.private
0 ...    libsystem_kernel.dylib  __select + 20
1    CoreFoundation  __CFSocketManager + 678
2    libsystem_c.dylib   _pthread_start + 308
Thread 8
0 ...    libsystem_kernel.dylib  __workq_kernreturn + 8
1    libsystem_c.dylib   _pthread_workq_return + 18
2    libsystem_c.dylib   _pthread_wqthread + 365
Blog Privacy

這是因為在視圖中你正在打開,在某個地方你試圖在UITableViewCell上調用一個名為row的方法。

您可以在崩潰日志的第一行看到這一點:

-[UITableViewCell row]: unrecognized selector sent to instance 0x1f8a6dd0

您應該跟蹤您正在調用row對象,並確保在您認為自己的對象上調用它而不是UITableViewCell

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM