2

我的 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
4

0 回答 0