次のエラーが表示されます。[__NSArrayM addObject:]
、NILオブジェクト。クラッシュしないで、私はなぜこれを思い出させるのかを知りたい。 は、ここでそれはオブジェクトが初期化され、メモリ内の参照を保持してきたことを意味私のコードエラー:[__NSArrayM addObject:]、NILオブジェクト
NSMutableArray *picturesCounts = [NSMutableArray array];
NSMutableArray *bigUrlArray = [NSMutableArray array];
NSMutableArray *pitcturesArray = [NSMutableArray array];
NSInteger i = 1;
for (TNHotelPictures *picture in pictures) {
NSString *pictureCounts = [NSString stringWithFormat:@"%ld",(long)picture.images.count];
[picturesCounts addObject:pictureCounts];
[pitcturesArray addObject:picture.images];
for (TNHotelDetailPhotoImages *photoImage in picture.images) {
[bigUrlArray addObject:photoImage.bigUrl];
}
i++;
}
NSInteger imageInAllIndex = imageIndex;
NSMutableArray *imagesCount = [NSMutableArray array];
for (NSInteger m = 0; m<i; m++) {
imagesCount = pitcturesArray[(typeIndex-(m+1))] ;
imageInAllIndex += imagesCount.count;
}
NSMutableArray *array = [NSMutableArray array];
for (NSString *url in bigUrlArray)
{
if (![url isKindOfClass:[NSString class]])
{
return;
}
TNHotelPhoto *photo = [[TNHotelPhoto alloc] initWithImageURL:[NSURL URLWithString:url]];
[array addObject:photo];
}
TNHotelPhotoSource *source = [[TNHotelPhotoSource alloc] initWithPhotos:array];
TNHotelDetailPhotoBrowserViewController *browserVC = [[TNHotelDetailPhotoBrowserViewController alloc] initWithPhotoSource:source WithImageIndex:imageInAllIndex>=0?imageInAllIndex:0 andImageArray:pictures andTypeIndex:typeIndex];
[UIManager showViewController:browserVC];
}
多分助けてください:http://stackoverflow.com/questions/12908045/nsarray-arraywithobjects-if-nil-is-meant-to-mark-array-end-can-i-do-nil-ni – luk2302
あなたのコード非常に奇妙なことをします。 – Sulthan