NSMutableArray 添加对象有限制吗?
NSMutableArray have restriction in adding object?
我正在使用 NSMutableArray
添加 objects.But 它只添加前 10 个对象。
我有分享代码
for (int j = 0; j<[feedData count]; j++)
{
[sharingItems addObject:[self whatsappdata:[feedData objectAtIndex:j]]];
}
此方法return 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
}
添加元素前需要给数组分配内存
sharingItems = [[NSMutableArray alloc]init];
很可能“获取限制”已经为'NSFetchRequest[=17=设置了]' 在您的代码中。
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
[fetchRequest setFetchLimit:10];//such code you need to find and remove/change fetch limit
我正在使用 NSMutableArray
添加 objects.But 它只添加前 10 个对象。
我有分享代码
for (int j = 0; j<[feedData count]; j++)
{
[sharingItems addObject:[self whatsappdata:[feedData objectAtIndex:j]]];
}
此方法return 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
}
添加元素前需要给数组分配内存
sharingItems = [[NSMutableArray alloc]init];
很可能“获取限制”已经为'NSFetchRequest[=17=设置了]' 在您的代码中。
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
[fetchRequest setFetchLimit:10];//such code you need to find and remove/change fetch limit