我想我的NSDictionary分配給我的NSArray,但每次在這裏的應用程序崩潰是我的代碼:嘗試指派的NSDictionary我的NSArray,但應用程序崩潰每次
NSDictionary *dict = [[NSDictionary alloc]init];
for (int i=0; i< myMutableArray.count; i++) {
dict = [NSDictionary dictionaryWithObjectsAndKeys:[[myMutableArray objectAtIndex:i]xmlhotel_name], @"hotelname",
[PriceArray objectAtIndex:i], @"startingfrom",
[[myMutableArray objectAtIndex:i]xmlhotel_city],@"city",
[DistanceArray objectAtIndex:i],@"distance",
[[myMutableArray objectAtIndex:i]xmlhotel_image],@"imagesnames",
[[myMutableArray objectAtIndex:i]xmlhotel_stars],@"numberofstars",
@"45.5016889",@"hotelLat",
@"-73.567256",@"hotelLong", nil];
}
NSArray *myArray = @[@{[dict allKeys] : [dict allValues]}];
,這裏是當我傳遞數據
BookATableController = [self.storyboard instantiateViewControllerWithIdentifier:@"bookatable"];
BookATableController.myMutableArray=[[NSMutableArray alloc]initWithArray:self.rssOutputData];/// Passing Data
BookATableController.PriceArray=[[NSMutableArray alloc]initWithArray:rssHotelPrice];/// Passing Data
BookATableController.DistanceArray=[[NSMutableArray alloc]initWithArray:rssHotelDistance];/// Passing
[self.view addSubview:BookATableController.view];
[self addChildViewController:BookATableController];
[BookATableController didMoveToParentViewController:self];
什麼是崩潰? – Avi
我嘗試了一個簡化的例子,並沒有崩潰。 – Avi
***終止應用程序由於未捕獲的異常「NSInvalidArgumentException」,原因是:「 - [NSNull長]:無法識別的選擇發送到實例0x19f0e4490」 –