Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/94.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 搜索栏和搜索显示,无法识别的选择器已发送到实例_Ios_Nspredicate_Uisearchbardisplaycontrol - Fatal编程技术网

Ios 搜索栏和搜索显示,无法识别的选择器已发送到实例

Ios 搜索栏和搜索显示,无法识别的选择器已发送到实例,ios,nspredicate,uisearchbardisplaycontrol,Ios,Nspredicate,Uisearchbardisplaycontrol,我的搜索栏有问题,我得到一个无法识别的选择器错误 2013-02-11 14:48:27.211分数(免费)[13946:c07]测试ijsid 包含[cd]“A”2013-02-11 14:48:27.213分数(免费)[13946:c07]测试 ( 阿克塞尔, “双轴”, “三轴”, “四轴”)2013-02-11 14:48:27.213分数(自由)[13946:c07]-[SingleElements isEqualToString:]:发送到实例0x755a5f0 2013-02-11

我的搜索栏有问题,我得到一个无法识别的选择器错误

2013-02-11 14:48:27.211分数(免费)[13946:c07]测试ijsid 包含[cd]“A”2013-02-11 14:48:27.213分数(免费)[13946:c07]测试 ( 阿克塞尔, “双轴”, “三轴”, “四轴”)2013-02-11 14:48:27.213分数(自由)[13946:c07]-[SingleElements isEqualToString:]:发送到实例0x755a5f0 2013-02-11 14:48:27.214分数(自由)[13946:c07] *由于未捕获异常“NSInvalidArgumentException”而终止应用程序,原因:'-[SingleElements] isEqualToString::无法识别的选择器已发送到实例0x755a5f0' *第一次抛出调用堆栈:(0x209f012 0x11ace7e 0x212A4 BD 0x208ebbc 0x208e94e 0x249e9f 0x24a064 0x2ae4 0x1ab8fb 0x1ab9cf 0x1941bb 0x192872 0x19d701 0x1a5d5d 0x1ade04 0x3d55f5 0x3d809e 0x327cc5 0x11c0705 0xf4213 0x1b5c7e 0x1b5310 0x1c213c 0x1cc5a6 0xc6d4f9 0x20f90c5 0x2053efa 0xba1bb2 0x38a39de 0x29f11da 0x2e2adfc 0x2e2dbf8 0x387e612 0x387e74a 0x387eec0 0x387ecb8 0x387e204 0x2c6c22b 0x2c6c193 0x3850e96 0x387D4C 0x2e28136 0x2e273c6 0x2e5a980 0x34b67fd 0x2e51576 0x2e526da 0x2e5072e 0x34b4eaa 0x2e6aaf1 0x2e5a72a 0x2e2e6ae 0x2a2d62b 0x11c06b0 0x3899810 0x2a6c1a4 0x2a6e2ff 0x2b20b4 0x274aef 0x275e58 0x2749fe 0x27ed29 0x101ddb 0x1ff7f5 0x1ff7f5 0x1ff7f5 0x1ff7f5 0x1ff7f5 0x1ff7f5 0x1ff7f5 0x1ff7f5 0x1ff7f5 0x1ff7f5 0x101e35 0x101806 0x101beb 0xf3698 0x1FFAD9 0x1FFAD0 0x2014bf5 0x2014962 0x2045bb6 0x2044f44 0x2044e1b 0x1ff97e3 0x1ff9668 0xf0ffc 0x1f8d 0x1eb5)libc++abi.dylib:终止 调用引发异常

(lldb)采购订单0x755a5f0$0=123053552轴

h

m

类SingleElements.h

@interface SingleElements : NSObject{
    NSString *group;
    NSString *ijsid;
    NSString *description;
    NSDecimalNumber *plus3;
    NSDecimalNumber *plus2;
    NSDecimalNumber *plus1;
    NSDecimalNumber *base;
    NSDecimalNumber *baseur;
    NSDecimalNumber *minus1;
    NSDecimalNumber *minus2;
    NSDecimalNumber *minus3;
    NSDecimalNumber *goeplus3;
    NSDecimalNumber *goeplus2;
    NSDecimalNumber *goeplus1;
    NSDecimalNumber *goeminus1;
    NSDecimalNumber *goeminus2;
    NSDecimalNumber *goeminus3;
}

@property(nonatomic,copy) NSString *group;
@property(nonatomic,copy) NSString *ijsid;
@property(nonatomic,copy) NSString *description;
@property(nonatomic,copy) NSDecimalNumber *plus3;
@property(nonatomic,copy) NSDecimalNumber *plus2;
@property(nonatomic,copy) NSDecimalNumber *plus1;
@property(nonatomic,copy) NSDecimalNumber *base;
@property(nonatomic,copy) NSDecimalNumber *baseur;
@property(nonatomic,copy) NSDecimalNumber *minus1;
@property(nonatomic,copy) NSDecimalNumber *minus2;
@property(nonatomic,copy) NSDecimalNumber *minus3;
@property(nonatomic,copy) NSDecimalNumber *goeplus3;
@property(nonatomic,copy) NSDecimalNumber *goeplus2;
@property(nonatomic,copy) NSDecimalNumber *goeplus1;
@property(nonatomic,copy) NSDecimalNumber *goeminus1;
@property(nonatomic,copy) NSDecimalNumber *goeminus2;
@property(nonatomic,copy) NSDecimalNumber *goeminus3;

@end

欢迎任何帮助,谢谢。

NSString
SingleElements
子类吗

我的猜测是,
isEqualToString
不适用于
SingleElements

你能为
SingleElements
类发布代码吗

编辑: 从您更新的问题中,我可以看到它是
NSObject
的一个子类,它不知道
IsequalString
与什么有关

为了到达坠机线(如果我猜对了,你不会有任何线索),请尝试以下操作:

  • 转到左侧窗格中的断点导航器
  • 单击屏幕底部的加号按钮
  • 选择添加异常断点
  • 在弹出的气泡中,在异常字段中选择Objective-C
  • 再次执行程序
  • 现在,尝试再次出现该异常。XCode将在崩溃之前将您带到该行。
    然后,把那条线贴在这里。也许是这样,我们可以找到解决方案。

    在哪一行出现此错误?cell.textlab.text=[self.searchResults objectAtIndex:indexPath.row];-我这样修复了它,SingleElements*SingleElements=[self.thesingleelementslistobjectatindex:indexPath.row];cell.textlab.text=singleElements.ijsid;-现在我有另一个问题,我在模拟器中得到了错误的结果,但它在日志中看起来是正确的。@Fabrice你能详细说明这个问题吗?你所说的错误结果是什么意思?我昨天有点累,但现在可以了。self.searchResults
    SingleElements*SingleElements=[self.searchResults objectAtIndex:indexPath.row]马特非常感谢你的帮助。
    
    @interface SingleElementsVC ()
    
    @end
    
    @implementation SingleElementsVC
    @synthesize thesingleelementslist;
    @synthesize searchDisplayController;
    @synthesize searchBar;
    @synthesize searchResults;
    
    - (id)initWithStyle:(UITableViewStyle)style
    {
        self = [super initWithStyle:style];
        if (self) {
            // Custom initialization
        }
        return self;
    }
    
    - (void)didReceiveMemoryWarning
    {
        // Releases the view if it doesn't have a superview.
        [super didReceiveMemoryWarning];
    
        // Release any cached data, images, etc that aren't in use.
    }
    
    #pragma mark - View lifecycle
    
    - (void)viewDidLoad
    {
        [super viewDidLoad];
        [self singleElementsList];
    }
    
    - (void)viewDidUnload
    {
        [super viewDidUnload];
        // Release any retained subviews of the main view.
        // e.g. self.myOutlet = nil;
    }
    
    - (void)viewWillAppear:(BOOL)animated
    {
        [super viewWillAppear:animated];
    }
    
    - (void)viewDidAppear:(BOOL)animated
    {
        [super viewDidAppear:animated];
    }
    
    - (void)viewWillDisappear:(BOOL)animated
    {
        [super viewWillDisappear:animated];
    }
    
    - (void)viewDidDisappear:(BOOL)animated
    {
        [super viewDidDisappear:animated];
    }
    
    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
    {
        // Return YES for supported orientations
        return (interfaceOrientation == UIInterfaceOrientationPortrait);
    }
    
    #pragma mark - Table view data source
    
    
    
    - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
    {
    
        // Return the number of sections.
        return 1;
    }
    
    - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
        NSString *sectionHeader = nil;
        sectionHeader = @"Scale Of Values For Single";
        return sectionHeader;
    }
    
    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
    {
    
        // Return the number of rows in the section.
        NSInteger rows = 0;
    
        if ([tableView
             isEqual:self.searchDisplayController.searchResultsTableView]){
            rows = [self.searchResults count];
        }
        else{
            rows = [self.thesingleelementslist count];
        }
    
        return rows;
    }
    
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
        static NSString *CellIdentifier = @"SingleElementsCell";
    
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
        if (cell == nil) {
            cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
        }
    
        if ([tableView isEqual:self.searchDisplayController.searchResultsTableView]){
            cell.textLabel.text = [self.searchResults objectAtIndex:indexPath.row];
        }
        else{
            SingleElements *singleElements = [self.thesingleelementslist objectAtIndex:indexPath.row];
            cell.textLabel.text = singleElements.ijsid;
            NSString *singleElementsDescriptionAndBase = [NSString stringWithFormat:@"%@ (%@)",singleElements.description, singleElements.base];
            cell.detailTextLabel.text = singleElementsDescriptionAndBase;
        }
    
        return cell;
    }
    
    -(NSMutableArray *) singleElementsList{
        thesingleelementslist = [[NSMutableArray alloc] initWithCapacity:10];
        @try {
            NSFileManager *fileMgr = [NSFileManager defaultManager];
            NSString *dbPath = [[[NSBundle mainBundle] resourcePath ]stringByAppendingPathComponent:@"ElementsDb.sqlite"];
            BOOL success = [fileMgr fileExistsAtPath:dbPath];
            if(!success)
            {
                NSLog(@"Cannot locate database file '%@'.", dbPath);
            }
            if(!(sqlite3_open([dbPath UTF8String], &db) == SQLITE_OK))
            {
                NSLog(@"An error has occured: %s", sqlite3_errmsg(db));
    
            }
            const char *sql = "SELECT * FROM single";
            sqlite3_stmt *sqlStatement;
            if(sqlite3_prepare(db, sql, -1, &sqlStatement, NULL) != SQLITE_OK)
            {
                NSLog(@"Problem with prepare statement:  %s", sqlite3_errmsg(db));
            }else{
    
                while (sqlite3_step(sqlStatement)==SQLITE_ROW) {
                    SingleElements * singleElements = [[SingleElements alloc] init];
                    singleElements.group = [NSString stringWithUTF8String:(char *) sqlite3_column_text(sqlStatement,1)];
                    singleElements.ijsid = [NSString stringWithUTF8String:(char *) sqlite3_column_text(sqlStatement,2)];
                    singleElements.description = [NSString stringWithUTF8String:(char *) sqlite3_column_text(sqlStatement,3)];
                    singleElements.plus3 = [[NSDecimalNumber alloc] initWithDouble:sqlite3_column_double(sqlStatement,4)];
                    singleElements.plus2 = [[NSDecimalNumber alloc] initWithDouble:sqlite3_column_double(sqlStatement,5)];
                    singleElements.plus1 = [[NSDecimalNumber alloc] initWithDouble:sqlite3_column_double(sqlStatement,6)];
                    singleElements.base = [[NSDecimalNumber alloc] initWithDouble:sqlite3_column_double(sqlStatement,7)];
                    singleElements.baseur = [[NSDecimalNumber alloc] initWithDouble:sqlite3_column_double(sqlStatement,8)];
                    singleElements.minus1 = [[NSDecimalNumber alloc] initWithDouble:sqlite3_column_double(sqlStatement,9)];
                    singleElements.minus2 = [[NSDecimalNumber alloc] initWithDouble:sqlite3_column_double(sqlStatement,10)];
                    singleElements.minus3 = [[NSDecimalNumber alloc] initWithDouble:sqlite3_column_double(sqlStatement,11)];
                    singleElements.goeplus3 = [singleElements.plus3 decimalNumberByAdding:singleElements.base];
                    singleElements.goeplus2 = [singleElements.plus2 decimalNumberByAdding:singleElements.base];
                    singleElements.goeplus1 = [singleElements.plus1 decimalNumberByAdding:singleElements.base];
                    singleElements.goeminus1 = [singleElements.minus1 decimalNumberByAdding:singleElements.base];
                    singleElements.goeminus2 = [singleElements.minus2 decimalNumberByAdding:singleElements.base];
                    singleElements.goeminus3 = [singleElements.minus3 decimalNumberByAdding:singleElements.base];
                    [thesingleelementslist addObject:singleElements];
                }
            }
        }
        @catch (NSException *exception) {
            NSLog(@"Problem with prepare statement:  %s", sqlite3_errmsg(db));
        }
        @finally {
            sqlite3_close(db);
    
            return thesingleelementslist;
        }
    }
    
    - (void)filterContentForSearchText:(NSString*)searchText
                                 scope:(NSString*)scope
    {
        NSPredicate *resultPredicate = [NSPredicate
                                        predicateWithFormat:@"ijsid contains[cd] %@",
                                        searchText];
    
        self.searchResults = [NSMutableArray arrayWithArray:[self.thesingleelementslist filteredArrayUsingPredicate:resultPredicate]];
    
         NSLog(@"test %@", searchResults);
    }
    
    #pragma mark - UISearchDisplayController delegate methods
    -(BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString
    {
        [self filterContentForSearchText:searchString scope:[[self.searchDisplayController.searchBar scopeButtonTitles] objectAtIndex:[self.searchDisplayController.searchBar selectedScopeButtonIndex]]];
    
        return YES;
    }
    
    - (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchScope:(NSInteger)searchOption
    {
        [self filterContentForSearchText:[self.searchDisplayController.searchBar text] scope:[[self.searchDisplayController.searchBar scopeButtonTitles] objectAtIndex:searchOption]];
    
        return YES;
    }
    
    -(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
        //if ([[segue identifier] isEqualToString:@"showDetail"]) {
    
            SingleElementsDetailView *detailViewController = [segue destinationViewController];
            SingleElements *singleElements = [[SingleElements alloc]init];
            detailViewController.singleElements = [self.singleElementsList objectAtIndex:[self.tableView indexPathForSelectedRow].row];
            singleElements = [self.singleElementsList objectAtIndex:[self.tableView indexPathForSelectedRow].row];
    
            NSLog(@"test %@", singleElements.ijsid);
            NSLog(@"test %@", singleElements.description);
            NSLog(@"test %@", singleElements.goeplus3);
            NSLog(@"test %@", singleElements.goeplus2);
            NSLog(@"test %@", singleElements.goeplus1);
            NSLog(@"test %@", singleElements.base);
            NSLog(@"test %@", singleElements.goeminus1);
            NSLog(@"test %@", singleElements.goeminus2);
            NSLog(@"test %@", singleElements.goeminus3);
        //}
    }
    
    @end
    
    @interface SingleElements : NSObject{
        NSString *group;
        NSString *ijsid;
        NSString *description;
        NSDecimalNumber *plus3;
        NSDecimalNumber *plus2;
        NSDecimalNumber *plus1;
        NSDecimalNumber *base;
        NSDecimalNumber *baseur;
        NSDecimalNumber *minus1;
        NSDecimalNumber *minus2;
        NSDecimalNumber *minus3;
        NSDecimalNumber *goeplus3;
        NSDecimalNumber *goeplus2;
        NSDecimalNumber *goeplus1;
        NSDecimalNumber *goeminus1;
        NSDecimalNumber *goeminus2;
        NSDecimalNumber *goeminus3;
    }
    
    @property(nonatomic,copy) NSString *group;
    @property(nonatomic,copy) NSString *ijsid;
    @property(nonatomic,copy) NSString *description;
    @property(nonatomic,copy) NSDecimalNumber *plus3;
    @property(nonatomic,copy) NSDecimalNumber *plus2;
    @property(nonatomic,copy) NSDecimalNumber *plus1;
    @property(nonatomic,copy) NSDecimalNumber *base;
    @property(nonatomic,copy) NSDecimalNumber *baseur;
    @property(nonatomic,copy) NSDecimalNumber *minus1;
    @property(nonatomic,copy) NSDecimalNumber *minus2;
    @property(nonatomic,copy) NSDecimalNumber *minus3;
    @property(nonatomic,copy) NSDecimalNumber *goeplus3;
    @property(nonatomic,copy) NSDecimalNumber *goeplus2;
    @property(nonatomic,copy) NSDecimalNumber *goeplus1;
    @property(nonatomic,copy) NSDecimalNumber *goeminus1;
    @property(nonatomic,copy) NSDecimalNumber *goeminus2;
    @property(nonatomic,copy) NSDecimalNumber *goeminus3;
    
    @end