在iphone应用程序中如何在后台调用方法?
我必须从后台调用sentRequest方法。如果sendRequest工作完成了,那么我必须调用iphone中的启动屏幕。我正在这样做,但这在dispatch\u async中无法正常工作。我调用这个CheckForUpdateModel类从后台获取所有值,然后调用view controller。但若我放置断点并显示,那个么它只调用sendrequest方法。它不调用此方法在iphone应用程序中如何在后台调用方法?,iphone,objective-c,Iphone,Objective C,我必须从后台调用sentRequest方法。如果sendRequest工作完成了,那么我必须调用iphone中的启动屏幕。我正在这样做,但这在dispatch\u async中无法正常工作。我调用这个CheckForUpdateModel类从后台获取所有值,然后调用view controller。但若我放置断点并显示,那个么它只调用sendrequest方法。它不调用此方法 -(void)connectionDidFinishLoading:(NSURLConnection *)connecti
-(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;
}
试试这个:-
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
});
});