我使用NSMutableArray
添加对象。但它只添加前10个对象。
我有分享代码
for (int j = 0; j<[feedData count]; j++)
{
[sharingItems addObject:[self whatsappdata:[feedData objectAtIndex:j]]];
}
此方法返回NSString
类型文本。
请为我提供有效的解决方案。
先谢谢
-(NSString *)whatsappdata:(NSDictionary *)cellData1
{
NSString *brandName = [NSString stringWithFormat:@"%@", [cellData1 objectForKey:@"brand_name"]];
NSString *modelName = [NSString stringWithFormat:@"%@", [cellData1 objectForKey:@"brand_model_name"]];
NSString *version = [NSString stringWithFormat:@"%@", [cellData1 objectForKey:@"version_name"]];
if ([version isEqualToString: @"<null>"])
{
version = @"";
}
NSString *year = [NSString stringWithFormat:@"%@", [cellData1 objectForKey:@"model_year"]];
if (year == nil || [year isEqualToString:@"0"])
{
year = @"";
}
NSString *inventoryValue = [NSString stringWithFormat:@"%@",[cellData1 objectForKey:@"inventory_type"]];
NSInteger value = [inventoryValue intValue];
NSString *inventoryName;
NSString *msg;
if(value == 1)
{
inventoryName = [NSString stringWithFormat:@"%@", @"Stock"];
i++;
NSString *text2 = [NSString stringWithFormat:@"%d.%@ %@ %@- %@ Single Owner\n",i, brandName, modelName, version, year];
msg = [NSString stringWithFormat:@"%@",text2];
msg= [msg stringByReplacingOccurrencesOfString:@"\n" withString:@"<br/>"];
}
else
{
inventoryName = [NSString stringWithFormat:@"%@", @"Required"];
msg = @"";
}
return msg;
//end data
}
答案 0 :(得分:1)
最有可能&#34; 获取限制 &#34;已设置为&#39; NSFetchRequest &#39;在你的代码中。
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
[fetchRequest setFetchLimit:10];//such code you need to find and remove/change fetch limit
答案 1 :(得分:0)
在添加元素之前需要为数组分配内存
sharingItems = [[NSMutableArray alloc]init];