简体   繁体   English

NSInvalidArgumentException:无法识别的选择器发送到实例

[英]NSInvalidArgumentException: unrecognized selector sent to instance

When I run my application I get this error: 当我运行我的应用程序时,出现以下错误:

    Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-
     [UIRoundedRectButton copyWithZone:]: unrecognized selector sent to instance
     0xcc86970'

Why I get an error like this? 为什么我会收到这样的错误? I was careful to check all connection of IBOutlets e all IBAction. 我非常仔细地检查了IBOutlets和所有IBAction的所有连接。 This is my code: 这是我的代码:

MenuViewController.h MenuViewController.h

     @interface MenuViewController : UIViewController
<UITableViewDelegate, UITableViewDataSource>{

}


@property (nonatomic, copy) IBOutlet UITableView * tableView;
@property (nonatomic,copy) IBOutlet UILabel *labelTitle;
@property (nonatomic, copy) IBOutlet UIButton *buttonHome;
@property (nonatomic, copy) IBOutlet UIButton *buttonMap;
@property (nonatomic, copy) IBOutlet UIButton *buttonFavorites;

 -(IBAction) pressedHome:(id)sender;
-(IBAction) pressedMap: (id)sender;
-(IBAction) pressedFavorites: (id)sender;

 @end

In MenuViewController.m 在MenuViewController.m中

 -(IBAction) pressedHome:(id)sender{

     MenuViewController * menu =[[MenuViewController alloc]initWithNibName:@"MenuViewController" bundle:nil];
   [self.navigationController pushViewController:menu animated:YES];


    }

  -(IBAction) pressedMap: (id)sender{

       MapViewController * map =[[MapViewController alloc]initWithNibName:@"MapViewController" bundle:nil];
       [self.navigationController pushViewController:map animated:YES];
   }


  -(IBAction) pressedFavorites: (id)sender{

        FavoritesViewController * favorites =[[FavoritesViewController alloc]initWithNibName:@"FavoritesViewController" bundle:nil];
       [self.navigationController pushViewController:favorites animated:YES];
   }

Thanks in advance 提前致谢

Remove the copy . 删除copy This is happening because UIButton (and other UIControls) don't conform to the NSCopying protocol, so the call to copy them fails. 发生这种情况是因为UIButton(和其他UIControl)不符合NSCopying协议,所以复制它们的调用失败。

Remove copy for the following properties 删除以下属性的copy

@property (nonatomic) IBOutlet UITableView * tableView;
@property (nonatomic) IBOutlet UILabel *labelTitle;
@property (nonatomic) IBOutlet UIButton *buttonHome;
@property (nonatomic) IBOutlet UIButton *buttonMap;
@property (nonatomic) IBOutlet UIButton *buttonFavorites;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 NSInvalidArgumentException无法识别的选择器已发送到实例 - NSInvalidArgumentException unrecognized selector sent to instance 无法识别的选择器已发送到实例(&#39;NSInvalidArgumentException&#39;) - Unrecognized selector sent to instance ('NSInvalidArgumentException') NSInvalidArgumentException:“无法识别的选择器发送到实例” - NSInvalidArgumentException: “Unrecognized selector sent to instance” NSInvalidArgumentException || 无法识别的选择器已发送到实例 - NSInvalidArgumentException || Unrecognized selector sent to instance iOS NSInvalidArgumentException,无法识别的选择器发送到实例 - iOS NSInvalidArgumentException, unrecognized selector sent to instance 错误:&#39;NSInvalidArgumentException&#39;...发送到实例的无法识别的选择器 - Error: 'NSInvalidArgumentException' … unrecognized selector sent to instance NSInvalidArgumentException - [__ NSCFString unsignedLongLongValue]:发送到实例的无法识别的选择器 - NSInvalidArgumentException -[__NSCFString unsignedLongLongValue]: unrecognized selector sent to instance NSInvalidArgumentException-[NSNull长度]:无法识别的选择器已发送到实例 - NSInvalidArgumentException -[NSNull length]: unrecognized selector sent to instance NSInvalidArgumentException,原因无法识别的选择器发送到实例 - NSInvalidArgumentException, reason unrecognized selector sent to instance 另一个“ NSInvalidArgumentException:无法识别的选择器发送到实例”帖子 - Another “NSInvalidArgumentException: unrecognized selector sent to instance” post
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM