gpt4 book ai didi

ios - Segue 标识符崩溃问题

转载 作者:行者123 更新时间:2023-12-01 17:53:07 25 4
gpt4 key购买 nike

这是我的 Storyboard和 homeSegue 标识符:

Story Board .. Segue Identifier is highlighted

这是我返回上一个 viewController 的代码块:

-(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{


if([segue.identifier isEqualToString:@"homeSegue"]){
ProductScannerViewController *product_scannerViewController = segue.destinationViewController;
product_scannerViewController.delegate=self;

}

if([segue.identifier isEqualToString:@"scanSegue"]){

[self.navigationController popToRootViewControllerAnimated:YES];

}

}

它让我回到 ScanProductViewController。但是,当我尝试再次从 ScanProductViewController 中单击搜索按钮时,出现以下异常:
 2014-05-03 16:05:51.349 Spisrett[5239:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+entityForName: nil is not a legal NSManagedObjectContext parameter searching for entity name 'Product''
*** First throw call stack:
(
0 CoreFoundation 0x021d71e4 __exceptionPreprocess + 180
1 libobjc.A.dylib

请建议我如何返回 ScanViewController 而不改变它以前的行为。

谢谢

这是它崩溃的方法..请建议:
-(void) configureFetchedResultsController:(NSString *) tableType;
{
//NSLog(@"This is the table tyoe");
//NSLog(tableType);

tableType=@"Product";
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription
entityForName:tableType inManagedObjectContext:self.context];
[fetchRequest setEntity:entity];
//Sorted by -Ishtiak
NSString *sortColumn=@"productTitle";



//actual sort..... decidedShortingColumn


NSSortDescriptor *sort = [[NSSortDescriptor alloc]
initWithKey:sortColumn ascending:YES];


[fetchRequest setSortDescriptors:[NSArray arrayWithObject:sort]];
[fetchRequest setFetchBatchSize:20];

NSFetchedResultsController *theFetchedResultsController =
[[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest
managedObjectContext:self.context
sectionNameKeyPath:nil
cacheName:nil];

fetchedResultsController = theFetchedResultsController;
fetchedResultsController.delegate = self;

}

最佳答案

奇怪的是,您使用 push segue 到 popToRootViewController。它不需要 segue 弹出或返回到以前的 View Controller 。

关于ios - Segue 标识符崩溃问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23442996/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com