[NSArrayM tableView]:无法识别的选择器

坦率

我有两天被困,因为我的NSArray无法正常工作。

当我运行该应用程序时,一切正常,但是当我触摸searchBar时,该应用程序已关闭原因:'-[__NSArrayM tableView]:无法识别的选择器已发送到实例0x16e34c50'

@implementation ViewController


-(BOOL)prefersStatusBarHidden
{
return YES;
}
- (void)viewDidLoad

{
[super viewDidLoad];

monthArray = [[ NSMutableArray alloc] initWithObjects:@"Paliwizumab",@"Opis przedmiotu zamówienia",@"Paliwizumab a 0,1g inj I.M ( proszek + rozpuszczalnik)",@"Paliwizumab a 0,05 g I.M ( proszek + rozpuszczalnik )",@"Nazwa międzynarodowa",@"PALIVISUMABUM*",@"Paliwizumab01",@"Paliwizumab02",@"Paliwizumab03",@"Paliwizumab04",@"Paliwizumab05",@"Paliwizumab06", nil];


[searchBar setParentController:self];
[searchBar setParentController:monthArray];
[searchBar setDelegate:searchBar];


[self prefersStatusBarHidden];

}
-(void) viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];
[[NSNotificationCenter defaultCenter] addObserver:searchBar selector:@selector(keyboardWillShow:) name:          (UIKeyboardWillShowNotification ) object:nil];
}

-(void)viewDidDisappear:(BOOL)animated

[super viewDidDisappear:animated];
[[NSNotificationCenter defaultCenter] removeObserver:searchBar];
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [[self monthArray]count];

}   


-(NSMutableArray*)monthArray
{
if (searchBar.isSearching == 1)
    return  searchBar.searchArray;

else
    return  monthArray;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{

static NSString *CellId = @"CellId";
UITableViewCell *cell = [self->_tableView dequeueReusableCellWithIdentifier:CellId];
if (! cell)
    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellId];
[cell.textLabel setText:[[self monthArray] objectAtIndex:indexPath. row]];
return cell;

}



@end

ViewController.h

#import <UIKit/UIKit.h>
#import "JPSearchBar.h"

@interface ViewController : UIViewController<UITableViewDelegate>

 {
NSMutableArray       *monthArray;
IBOutlet JPSearchBar *searchBar;
}


@property (strong, nonatomic) IBOutlet UITableView *tableView;

-(NSMutableArray*)monthArray;


@end
泰兰·卡默(TaylanKammer)

在Objective-C中,“无法识别的选择器”错误表示您试图在对象上执行方法(即“向其发送消息”,其中“消息”由“选择器”标识),但是该对象没有实现该方法(即“无法识别该选择器”)。

当您拥有错误类的对象时,通常会发生这种情况。在这种情况下,我猜想setParentController:方法searchBar期望某个实现的对象tableView(也许self是因为我看到它具有一个tableView属性,这意味着它具有一个tableViewgetter方法),但您却给了它monthArray不过,这只是一个猜测,因为其余的代码丢失了。(例如什么JPSearchBar?)

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

NSArrayM无法识别的选择器错误

来自分类Dev

Swift:NSArrayM controllerWillChangeContent:]:无法识别的选择器已发送至实例

来自分类Dev

[__NSArrayM objectForKeyedSubscript:]:无法识别的选择器已发送至实例-附带源代码和屏幕截图

来自分类Dev

尝试从字典中检索字符串时出现“ [__NSArrayM objectForKey:]:无法识别的选择器”

来自分类Dev

ARC下的NSString可能导致-[__ NSArrayM长度]:无法识别的选择器发送到实例吗?

来自分类Dev

由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:'-[__ NSArrayM itemName]:无法识别的选择器已发送到实例

来自分类Dev

setNeedsStatusBarAppearanceUpdate无法识别的选择器

来自分类Dev

无法识别的选择器mutableCopyWithZone

来自分类Dev

setNeedsStatusBarAppearanceUpdate无法识别的选择器

来自分类Dev

SortedArrayUsingSelector无法识别的选择器

来自分类Dev

无法识别的选择器mutableCopyWithZone

来自分类Dev

SIGABRT /无法识别的选择器

来自分类Dev

如何识别无法识别的选择器和无法识别的选择器?

来自分类Dev

删除行时出现TableView“无法识别的选择器发送到实例”错误

来自分类Dev

'NSInvalidArgumentException'-[UIViewController tableView:numberOfRowsInSection:]-无法识别的选择器已发送到实例

来自分类Dev

[tableView:numberOfRowsInSection:]:无法识别的选择器已发送到实例

来自分类Dev

从解析中删除对象/无法转换为PFObject / NSArrayM

来自分类Dev

无法让 NSKeyedArchiver 工作:无法识别的选择器

来自分类Dev

TableView的内容未出现“ tableView:numberOfRowsInSection:]:无法识别的选择器已发送到实例”

来自分类Dev

NSNull isEqualToString:ObjC上无法识别的选择器

来自分类Dev

目标动作模式的快速无法识别的选择器

来自分类Dev

无法识别的选择器isPitched被调用

来自分类Dev

UIButton setFrame无法识别的选择器alignmentRectInsets

来自分类Dev

CCAnimation使用无法识别的选择器setDisplayFrame崩溃

来自分类Dev

collationStringSelector错误:无法识别的选择器

来自分类Dev

iOS无法识别的对象选择器

来自分类Dev

无法识别的选择器UIDeviceRGBColor countByEnumeratingWithState:objects:count:

来自分类Dev

提取请求“无法识别的选择器”错误

来自分类Dev

[ViewController presentPopupViewController:animationType:]:无法识别的选择器

Related 相关文章

  1. 1

    NSArrayM无法识别的选择器错误

  2. 2

    Swift:NSArrayM controllerWillChangeContent:]:无法识别的选择器已发送至实例

  3. 3

    [__NSArrayM objectForKeyedSubscript:]:无法识别的选择器已发送至实例-附带源代码和屏幕截图

  4. 4

    尝试从字典中检索字符串时出现“ [__NSArrayM objectForKey:]:无法识别的选择器”

  5. 5

    ARC下的NSString可能导致-[__ NSArrayM长度]:无法识别的选择器发送到实例吗?

  6. 6

    由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:'-[__ NSArrayM itemName]:无法识别的选择器已发送到实例

  7. 7

    setNeedsStatusBarAppearanceUpdate无法识别的选择器

  8. 8

    无法识别的选择器mutableCopyWithZone

  9. 9

    setNeedsStatusBarAppearanceUpdate无法识别的选择器

  10. 10

    SortedArrayUsingSelector无法识别的选择器

  11. 11

    无法识别的选择器mutableCopyWithZone

  12. 12

    SIGABRT /无法识别的选择器

  13. 13

    如何识别无法识别的选择器和无法识别的选择器?

  14. 14

    删除行时出现TableView“无法识别的选择器发送到实例”错误

  15. 15

    'NSInvalidArgumentException'-[UIViewController tableView:numberOfRowsInSection:]-无法识别的选择器已发送到实例

  16. 16

    [tableView:numberOfRowsInSection:]:无法识别的选择器已发送到实例

  17. 17

    从解析中删除对象/无法转换为PFObject / NSArrayM

  18. 18

    无法让 NSKeyedArchiver 工作:无法识别的选择器

  19. 19

    TableView的内容未出现“ tableView:numberOfRowsInSection:]:无法识别的选择器已发送到实例”

  20. 20

    NSNull isEqualToString:ObjC上无法识别的选择器

  21. 21

    目标动作模式的快速无法识别的选择器

  22. 22

    无法识别的选择器isPitched被调用

  23. 23

    UIButton setFrame无法识别的选择器alignmentRectInsets

  24. 24

    CCAnimation使用无法识别的选择器setDisplayFrame崩溃

  25. 25

    collationStringSelector错误:无法识别的选择器

  26. 26

    iOS无法识别的对象选择器

  27. 27

    无法识别的选择器UIDeviceRGBColor countByEnumeratingWithState:objects:count:

  28. 28

    提取请求“无法识别的选择器”错误

  29. 29

    [ViewController presentPopupViewController:animationType:]:无法识别的选择器

热门标签

归档