我有一个从数据库中提取字符串的方法(我使用nodejs和mongodb)。当我的应用程序进行调用数据返回时。但我的应用程序不会再次拨打同一个电话。例如,当我输入用户名:JohnDoe123时,我希望后端发送回与JohnDoe123相关联的ID。但我希望能够再次进行相同的查询,所以我需要以某种方式清除缓存吗?
if ([jsonn objectForKey:@"success"]) {
NSNumber* successful = [jsonn objectForKey:@"success"];
if ([successful boolValue]) {
NSString* idforpic = (NSString*)[jsonn objectForKey:@"idforpic"];
NSLog(@"idforpic: %@", idforpic);
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:idforpic forKey:@"CURRENTPICID"];
if (idforpic != nil) {
picView = [[ProfilePicViewController alloc] initWithId:idforpic];
[picView.view setFrame:CGRectMake(0, self.view.frame.size.height / 3, self.view.frame.size.width, 150)];
[picView setImageUsingId:idforpic];
[self addChildViewController:picView];
[self.view addSubview:picView.view];
removePicView = [NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector(removeProfilePicViewController) userInfo:nil repeats:NO];
}
}
}
基本上,我需要能够多次运行if(idforpic!= nil)中包含的所有内容