Reputation: 544
I have to call sentRequest method from background. If sendRequest work is done then i have to call splash screen in iphone. I am doing this but this not working proper in dispatch_async. I am calling this CheckForUpdatesModal class for getting all value from background then call view controller. But if i put breakpoint and show, then it is calling only sendrequest method. It not calling this method
-(void)connectionDidFinishLoading:(NSURLConnection *)connection pleasehelp me here what is wrong some give me this ans to follow dispatch and my xcode version is4.2
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[BaseModalcopyDatabaseIfNeeded];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{
NSLog(@"pradeep"); // Here you can define your code to execute in background.});
CheckForUpdatesModal *CFUM = [[CheckForUpdatesModal alloc]init];
[CFUM sendRequest];
[CFUM release];
});
self.SSView = [[[SplashScreenView alloc] initWithNibName:@"SplashScreenView" bundle:nil] autorelease];
self.window.rootViewController = SSView;
[self.window makeKeyAndVisible];
return YES;
}
Upvotes: 1
Views: 426
Reputation: 2676
Try this :-
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0ul);
dispatch_async(queue, ^{
CheckForUpdatesModal *CFUM = [[CheckForUpdatesModal alloc]init];
[CFUM sendRequest];
[CFUM release];
dispatch_sync(dispatch_get_main_queue(), ^{
//SHOW UR SPLASH SCREEN HERE
});
});
Upvotes: 2