我使用查询 FindObjectsInBackgroundWithBlock (assync) 从 web 服务中获取值...我希望在应用加载之前在 appdelegate 上获得该值。我正在尝试这样做,但他仍然在检查网络服务以获取价值之前加载应用程序。我该如何处理?我已经尝试过使用 NSTimer ..
我在以下位置调用了此方法-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
:
-(void)checkUserVersion{
PFQuery *query = [PFQuery queryWithClassName:@"sqliteversion"]; //1
// NSNumber *n=databaseVersion;
[query whereKey:@"user_version" equalTo:[NSNumber numberWithInt:[databaseVersion integerValue]]];//2
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {//4
if (!error && [objects count]>0) {
for (PFObject *object in objects) {
valor1=[[object objectForKey:@"Value"]intValue];
user_version=[NSNumber numberWithInt:valor1];
}
}
}];
}