【问题标题】:ACAccount Unrecognized selector sent to instance(NSInvalidArgumentException)ACAccount 无法识别的选择器发送到实例(NSInvalidArgumentException)
【发布时间】:2018-09-23 20:25:46
【问题描述】:

我选择了一个现有帐户。我想通过另一个viewController这个选定的帐户。但是我得到了这个错误 --> "Unrecognized selector sent to instance"

这是我的代码:

tableView上选择帐户:

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    AccountsTableViewCell *selectedRow = [self.accountTable cellForRowAtIndexPath:indexPath];
    choosenAccount = selectedRow.twitAccount;
     [self performSegueWithIdentifier:@"selectAccount" sender: nil];

}

转场:

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if ([segue.identifier isEqualToString:@"selectAccount"]) {
         TwitterFollowersViewController *vc = (TwitterFollowersViewController *) segue.destinationViewController;
        vc.twitterAccount = choosenAccount;
    }
}

ViewController.h文件:

@interface TwitterFollowersViewController : UIViewController
      @property (retain, nonatomic) ACAccount *twitterAccount;
@end

日志:

2014-05-10 23:54:13.297 tweet++[10143:60b] -[UIViewController setTwitterAccount:]: unrecognized selector sent to instance 0xa45d870
2014-05-10 23:54:13.300 tweet++[10143:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController setTwitterAccount:]: unrecognized selector sent to instance 0xa45d870'
*** First throw call stack:
(
    0   CoreFoundation                      0x0194e1e4 __exceptionPreprocess + 180
    1   libobjc.A.dylib                     0x016cd8e5 objc_exception_throw + 44
    2   CoreFoundation                      0x019eb243 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
    3   CoreFoundation                      0x0193e50b ___forwarding___ + 1019
    4   CoreFoundation                      0x0193e0ee _CF_forwarding_prep_0 + 14
    5   tweet++                             0x000071ac -[TwitterAccountsViewController prepareForSegue:sender:] + 268
    6   UIKit                               0x008f1efa -[UIStoryboardSegueTemplate _perform:] + 156
    7   UIKit                               0x004ae41c -[UIViewController performSegueWithIdentifier:sender:] + 72
    8   UIKit                               0x0f20f8fc -[UIViewControllerAccessibility(SafeCategory) performSegueWithIdentifier:sender:] + 63
    9   tweet++                             0x00006fff -[TwitterAccountsViewController tableView:didSelectRowAtIndexPath:] + 287
    10  UIKit                               0x004779a1 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1513
    11  UIKit                               0x00477b14 -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 279
    12  UIKit                               0x0047c10e __38-[UITableView touchesEnded:withEvent:]_block_invoke + 43
    13  UIKit                               0x003ab0aa ___afterCACommitHandler_block_invoke + 15
    14  UIKit                               0x003ab055 _applyBlockToCFArrayCopiedToStack + 403
    15  UIKit                               0x003aae76 _afterCACommitHandler + 532
    16  CoreFoundation                      0x0191636e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
    17  CoreFoundation                      0x019162bf __CFRunLoopDoObservers + 399
    18  CoreFoundation                      0x018f4254 __CFRunLoopRun + 1076
    19  CoreFoundation                      0x018f39d3 CFRunLoopRunSpecific + 467
    20  CoreFoundation                      0x018f37eb CFRunLoopRunInMode + 123
    21  GraphicsServices                    0x01bab5ee GSEventRunModal + 192
    22  GraphicsServices                    0x01bab42b GSEventRun + 104
    23  UIKit                               0x0038df9b UIApplicationMain + 1225
    24  tweet++                             0x000076ad main + 141
    25  libdyld.dylib                       0x04fdc701 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

【问题讨论】:

  • 检查 storyboard 中的类名,它认为是 UIViewController 而不是 TwitterFollowersViewController。
  • 谷歌“无法识别的选择器”。研究出现的几个参考文献。
  • (prepareForSegue 中的vc 不是 TwitterFollowersViewController。)

标签: ios objective-c acaccount


【解决方案1】:

检查情节提要中的类名,我认为它是 UIViewController 而不是 TwitterFollowersViewController。

【讨论】:

    猜你喜欢
    • 2013-12-26
    • 2012-07-16
    • 2018-01-19
    • 1970-01-01
    • 1970-01-01
    • 2016-08-05
    • 2012-02-21
    • 2015-08-02
    相关资源
    最近更新 更多