안녕하세요 친구 코어 데이터에서 가져 오기 요청을 수행하는 동안 내 응용 프로그램이 충돌합니다. 아래는 충돌하는 동안 표시되는 메시지입니다.코어 데이터에서 레코드를 가져 오는 동안 응용 프로그램이 충돌하는 경우
는 "2014년 10월 7일 14 : 38 : 07.203 사회 [1540 : 60B] - [AppDelegate에 fetchAllAds] : 38 : 07.209 사회적 인식 선택기 인스턴스 0x9725da0 2014년 10월 7일 (14)로 전송 [1540 60B] * 인해 캐치되지 않는 예외 'NSInvalidArgumentException', ** 이유로 응용 프로그램 종료 : -
(
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 : *** 먼저 던져 호출 스택 '[AppDelegate에 fetchAllAds] 인식 할 수없는 선택기 인스턴스 0x9725da0로 전송' ++ abi.dylib : NSException 유형의 catch되지 않는 예외로 종료합니다. (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라는 별개의 파일에서 폐기했습니다.
새 개체를 만드는 경우
그래서 [AppDelegate에 가져 오기 광고] ...하지만 내가 무엇을 할 수 있는지 보여줍니다. – user3354840
@ user3354840 네,하지만 DBManager * manager'를 가지고 있고 그 중에'app delegate '를 넣고 있습니다. 그러면'fetchAllAds'를 실행하려고하면 존재하지 않습니다. 당신은'DBManager'를 만들고 그것을'manager' 속성에 넣어야합니다. – Fogmeister
지금은 응용 프로그램이 작동 중입니다 ...하지만 모든 필드는 null .. 무엇을 할 수 있습니다 ..하지만 데이터는 DB에 저장됩니다. – user3354840