【发布时间】:2014-12-01 16:18:59
【问题描述】:
朋友们,我的应用程序在核心数据中执行获取请求时崩溃了。以下是崩溃时显示的消息。
“2014-10-07 14:38:07.203 Social[1540:60b] -[AppDelegate fetchAllAds]:无法识别的选择器发送到实例 0x9725da0 2014-10-07 14:38:07.209 Social[1540:60b] * 由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,**原因:'-[AppDelegate fetchAllAds]: 无法识别的选择器发送到实例0x9725da0' *** 首先抛出调用栈:
(
0 CoreFoundation 0x025201e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x01e1e8e5 objc_exception_throw + 44
2 CoreFoundation 0x025bd243 -[NSObject(NSObject)
doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x0251050b ___forwarding___ + 1019
4 CoreFoundation 0x025100ee _CF_forwarding_prep_0 + 14
5 Social 0x00002e5b -[ShoppingCartViewController viewDidLoad] +
139
6 UIKit 0x00bfd33d -[UIViewController loadViewIfRequired] + 696
7 UIKit 0x00bfd5d9 -[UIViewController view] + 35
8 UIKit 0x00c0cf89 -[UIViewController shouldAutorotate] + 36
9 UIKit 0x00c0d2d1 -[UIViewController _preferredInterfaceOrientationForPresentationInWindow:fromInterfaceOrientation:] + 297
10 UIKit 0x00eab3d5 -[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:animation:] + 2330
11 UIKit 0x00c095d5 -[UIViewController presentViewController:withTransition:completion:] + 6538
12 UIKit 0x00c09aef -[UIViewController presentViewController:animated:completion:] + 130
13 UIKit 0x00c09b2f -[UIViewController presentModalViewController:animated:] + 56
14 UIKit 0x01053e00 -[UIStoryboardModalSegue perform] + 271
15 UIKit 0x01042f0c -[UIStoryboardSegueTemplate _perform:] + 174
16 UIKit 0x01042f87 -[UIStoryboardSegueTemplate perform:] + 115
17 libobjc.A.dylib 0x01e30880 -[NSObject performSelector:withObject:withObject:] + 77
18 UIKit 0x00ae03b9 -[UIApplication sendAction:to:from:forEvent:] + 108
19 UIKit 0x00ae0345 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61
20 UIKit 0x00be1bd1 -[UIControl sendAction:to:forEvent:] + 66
21 UIKit 0x00be1fc6 -[UIControl _sendActionsForEvents:withEvent:] + 577
22 UIKit 0x00be1243 -[UIControl touchesEnded:withEvent:] + 641
23 UIKit 0x00b1fddd -[UIWindow _sendTouchesForEvent:] + 852
24 UIKit 0x00b209d1 -[UIWindow sendEvent:] + 1117
25 UIKit 0x00af25f2 -[UIApplication sendEvent:] + 242
26 UIKit 0x00adc353 _UIApplicationHandleEventQueue + 11455
27 CoreFoundation 0x024a977f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
28 CoreFoundation 0x024a910b __CFRunLoopDoSources0 + 235
29 CoreFoundation 0x024c61ae __CFRunLoopRun + 910
30 CoreFoundation 0x024c59d3 CFRunLoopRunSpecific + 467
31 CoreFoundation 0x024c57eb CFRunLoopRunInMode + 123
32 GraphicsServices 0x03ca25ee GSEventRunModal + 192
33 GraphicsServices 0x03ca242b GSEventRun + 104
34 UIKit 0x00adef9b UIApplicationMain + 1225
35 Social 0x00017a2d main + 141
36 libdyld.dylib 0x0393b701 start + 1
37 ??? 0x00000001 0x0 + 1
) libc++abi.dylib:以 NSException 类型的未捕获异常终止 (lldb)
以下是我的代码。
- (void)viewDidLoad
{
DBManager* manager = [UIApplication sharedApplication].delegate;
self.fetchedRecordsArray = [manager fetchAllAds];
[self.shoppingtbl reloadData];
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// Return the number of sections.
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [self.fetchedRecordsArray count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath
*)indexPath
{
static NSString *CellIdentifier = @"ShoppingCart";
ShoppingCart *cell = (ShoppingCart*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier
forIndexPath:indexPath];
Ad * record = [self.fetchedRecordsArray objectAtIndex:indexPath.row];
cell.addesc.text = [NSString stringWithFormat:@"%@",record.data];
return cell;
}
请注意,我已经在名为 dbmanager 的单独文件中停用了所有核心数据功能。
【问题讨论】:
标签: ios uitableview core-data ios7 xcode5