-1
在我的ios應用程序中,我已經包括谷歌,臉譜和推特整合。當應用程序啓動時,它在加載UI之前加載API。多線程iOS,快速啓動UI
如何以我的UI加載多線程首先快速啓動。我didFinishLaunchingWithOptions是。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
// Add code here to do background processing
//
//
NSLog(@"Thread Excecution started");
NSError* configureError;
[[GGLContext sharedInstance] configureWithError: &configureError];
NSAssert(!configureError, @"Error configuring Google services: %@", configureError);
[GIDSignIn sharedInstance].delegate = self;
[[FBSDKApplicationDelegate sharedInstance] application:application
didFinishLaunchingWithOptions:launchOptions];
dispatch_async(dispatch_get_main_queue(), ^{
// Add code here to update the UI/send notifications based on the
// results of the background processing
NSLog(@"Thread Excecution completed");
});
});
return YES;
}
您知道,即使在主線程中,通知實際上可能會觸發並被接收,但無法保證嗎?你確定要這麼做嗎? – NSNoob
爲什麼你需要在後臺線程中編寫外部API的啓動代碼呢? – NSNoob
我可以在Viewdidload中添加這些代碼嗎?是的,將工作 – Saranjith