检查webservice响应数据是否已插入iphone中的sqlite的条件?
我已经插入了我的第一个数据。我的问题是,当我插入下一个数据时,从第一个数据开始循环计数,并以最后一个数据结束检查webservice响应数据是否已插入iphone中的sqlite的条件?,iphone,objective-c,ios,Iphone,Objective C,Ios,我已经插入了我的第一个数据。我的问题是,当我插入下一个数据时,从第一个数据开始循环计数,并以最后一个数据结束 -(void)GetAllSplitDataHandler:(id)value { int j; // NSError error; if([value isKindOfClass:[NSError class]]) { NSLog(@"%@", value); return; } // Handle faults if([value isKind
-(void)GetAllSplitDataHandler:(id)value {
int j;
// NSError error;
if([value isKindOfClass:[NSError class]])
{
NSLog(@"%@", value); return;
}
// Handle faults
if([value isKindOfClass:[SoapFault class]])
{
NSLog(@"%@", value);
return;
}
NSMutableArray result = (NSMutableArray*)value;
NSLog(@"GetAllAtheleteHandler returned the value: %@", result );
if([[NSString stringWithFormat:@"%@",result] isEqualToString:@"1"]){
NSLog(@"Result Count :: %d",[result count]);
for (int i =0; i<[result count]; i++) {
NSMutableDictionary *dic=[[NSMutableDictionary alloc]init];
[dic setValue:[[result objectAtIndex:0] valueForKey:@"entity1"] forKey:@"entity1"];
[dic setValue:[[result objectAtIndex:0] valueForKey:@"entity2"] forKey:@"entity2"];
DAL *objDAL=[[DAL alloc]initDatabase:@"Abc.sqlite"];
j = [objDAL insertRecord1:dic inTable:@"Abc"];
if (j == 0) {
NSLog(@"Inserted Successfully");
}
else if(j == -1)
{
NSLog(@"Insertion Failed");
// NSAssert1(0, @"Insertion Failure '%@'.", [error localizedDescription]);
}
}
}
-(void)GetAllSplitDataHandler:(id)值{
int j;
//n误差;
if([value iskindof类:[n错误类]])
{
NSLog(@“%@”,值);返回;
}
//处理故障
if([value iskindof类:[SoapFault类]])
{
NSLog(@“%@”,值);
返回;
}
NSMutableArray结果=(NSMutableArray*)值;
NSLog(@“GetAllateHandler返回值:%@”,结果);
如果([[NSString stringWithFormat:@“%@”,结果]IsequalString:@“1”]){
NSLog(@“结果计数::%d”,[结果计数]);
对于(int i=0;i您可以保存id(在NSUserDefaults
中)上次插入的数据,下次调用Web服务时,您只需从先前保存的id旁边的id插入数据。您可以使用其中一个数据值作为数据库中的唯一键约束。如果该键将被复制,则不会在数据库中插入行。请在你已经试过了。@Roma请不要在评论中发布代码,编辑你的问题instead@Roma存储数据的代码?以及您从webservice得到的唯一响应。您不必从项目中编写任何代码。请告诉我数据库表中所有列的名称