iOS:需要数据通信帮助

iOS:需要数据通信帮助,ios,model-view-controller,uistoryboardsegue,Ios,Model View Controller,Uistoryboardsegue,我遵循MVC模式进行数据通信,我不知道到底发生了什么问题。我们需要解决这个问题。 场景是: 我有一类列表项目,即:模型 我在first view controller中发出请求并获取所有显示的结果。但我无法将值传递给详细视图控制器 在FirstVC.h中 @property (nonatomic, retain) NSMutableArray * ads_Array; 在FirstVC.m [manager GET:self.urlString parameters:nil progre

我遵循MVC模式进行数据通信,我不知道到底发生了什么问题。我们需要解决这个问题。 场景是:
我有一类列表项目,即:模型



我在first view controller中发出请求并获取所有显示的结果。但我无法将值传递给详细视图控制器
在FirstVC.h中

@property (nonatomic, retain) NSMutableArray * ads_Array;
在FirstVC.m

[manager GET:self.urlString parameters:nil progress:nil success:^(NSURLSessionTask * task, id responseObject)
 {

     NSLog(@"Response for #%d request is: %@",_currentPage,responseObject);

     _totalPages = [[responseObject objectForKey:@"total_pages"]integerValue];


     for (int i = 0;i<[[responseObject valueForKey:@"items"]count];i++)

     {
         Listing_Ads * ads = [[Listing_Ads alloc] initWithDictionary:[responseObject objectForKey:@"items"][i]];
         if (![self.ads_Array containsObject:ads])
         {
             [self.ads_Array addObject:ads];
         }
     }


详细说明svc.h


执行此操作时,您甚至没有传递值:-

 -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
    {

        UIStoryboard * storyboard = [UIStoryboard storyboardWithName:@"Main" bundle: nil];
        DetailsVC * vc = [storyboard instantiateViewControllerWithIdentifier:@"DetailsVC"];
         //you missed this line-- pass value
         vc.detailsListing= [[Listing_Ads alloc] initWithDictionary:self.ads_Array[indexPath.row]];
        [self presentViewController:vc animated:YES completion:nil];

    }

清单2是NSObject类还是UIViewController?您错过了两个主要代码:-第一个是在存储时,第二个是将对象传递给另一个视图控制器。向我们显示该对象的代码class@Vizllx我已经更新了代码片段,希望现在有意义了。@magid您错过了第二点……您是如何将值从FirstVC传递到DetailVC的?代码在哪里?我这样做了,但应用程序正在崩溃。。以某种方式你知道什么是调试吗?如何在XCode中设置断点。你知道怎么看坠机报告吗?如果不是谷歌的话;)请告诉我,initWithDictionary如何给它赋值?vc.detailsList=[[Listing\u Ads alloc]initWithDictionary:self.Ads\u Array[indexPath.row]];
 -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
    {
        Listing_Ads * selectedItem = self.ads_Array[indexPath.row];


        NSLog(@"ads%@",selectedItem);

        UIStoryboard * storyboard = [UIStoryboard storyboardWithName:@"Main" bundle: nil];
        DetailsVC * vc = [storyboard instantiateViewControllerWithIdentifier:@"DetailsVC"];

        [self presentViewController:vc animated:YES completion:nil];

    }
#import "Listing_Ads.h"
@class Listing_Ads;

@interface DetailsVC : NavigationHandler<UITableViewDataSource,UITableViewDelegate>

@property(strong,nonatomic) Listing_Ads * detailsListing;

@end
@interface DetailsVC ()
@end
@implementation DetailsVC

- (void)viewDidLoad
{
    // Update the user interface for the detail vehicle, if it exists.
    if (self.detailsListing)
    {
        //Set the View Controller title, which will display in the Navigation bar.
        NSLog(@"All Values here:%@",[self.detailsListing details_Listing]);
    }
}
 -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
    {

        UIStoryboard * storyboard = [UIStoryboard storyboardWithName:@"Main" bundle: nil];
        DetailsVC * vc = [storyboard instantiateViewControllerWithIdentifier:@"DetailsVC"];
         //you missed this line-- pass value
         vc.detailsListing= [[Listing_Ads alloc] initWithDictionary:self.ads_Array[indexPath.row]];
        [self presentViewController:vc animated:YES completion:nil];

    }