“无法识别的选择器发送到实例”UINavigationController

时间:2013-03-15 07:42:06

标签: xcode setter

我的Xcode应用收到以下异常错误消息。

-[UINavigationController setDeals:]: unrecognized selector sent to instance 0x8338d40

prepareForSegue:方法的以下上下文中抛出了异常,可能是destination项。抛出异常的关键行标有此注释。 //**********exception

BSViewController.h

#import <UIKit/UIKit.h>
@class BSData;
@interface BSViewController : UIViewController <UITextViewDelegate, UITextFieldDelegate>
{
    }
@property (nonatomic) NSInteger iboard;
@property (nonatomic, strong) NSArray *deals;
@property (nonatomic, strong) BSData *data;
@end

BSViewController.m

#import "BSViewController.h"
#import "BSdealViewController.h"
#import "BSData.h"

@interface BSViewController ()
@end

@implementation BSViewController
@synthesize iboard, deals;

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // The identifier here must match the one you assigned to the segue in the storyboard.
    NSLog(@"identifier=%@ destination=%@", segue.identifier, segue.destinationViewController);
    if ([segue.identifier isEqualToString:@"UrlToDeal"]) {
        BSData *data;
        BSdealViewController *destination = segue.destinationViewController;
        data = [[BSData alloc] initWithNumber:self.iboard array:self.deals];
        NSLog(@"segue iboard:%d", self.iboard);
        NSLog(@"segue deals:%@", self.deals);
        destination.deals = self.deals;    //**********exception
        destination.iboard = self.iboard;
    }
}
@end

BSData.h

#import <Foundation/Foundation.h>

@interface BSData : NSObject
@property (nonatomic) NSInteger iboard;
@property (nonatomic, copy) NSArray * deals;
- (id)initWithNumber:(NSInteger)iboard array:(NSArray *)deals;

@end

BSData.m

#import "BSData.h"

@implementation BSData
- (id)initWithNumber:(NSInteger)iboard array:(NSArray *)deals
{
    self = [super init];
    if (self) {
        NSLog(@"self initWithNumber");
        _iboard = iboard;
        _deals = deals;
        return self;
    }
    return nil;
}
@end

BSdealViewController.h

#import <UIKit/UIKit.h>
#import <Accelerate/Accelerate.h>
#include "BSParam.h"
@class BSData;

@interface BSdealViewController : UIViewController <UINavigationControllerDelegate>

@property (nonatomic, strong) BSData *data;
@property (nonatomic) NSInteger iboard;
@property (nonatomic, weak) NSArray *deals;

@end

BSdealViewController.m

#import "BSData.h"
#import "BSdealViewController.h"
#import "BSViewController.h"

@interface BSdealViewController ()
@end

0 个答案:

没有答案