2015-12-17 64 views
1

我在我的swift項目中使用SVProgressHUD作爲框架。它在iOS 8中工作正常。我在我的應用程序中使用Facebook登錄。每當我使用登錄SVProgressHUD不顯示整個應用程序。但是,當我殺了應用程序,並推出SVProgressHUD將工作正常。我已經在info.plist中添加了必需的密鑰。我無法弄清楚這個問題。請任何人提供解決方案。當應用程序使用Facebook登錄時,SVProgressHud未在iOS 9中顯示

編輯:如果我將「loginbehaviour」更改爲Web和SystemAccount。它工作正常。

環境 FBSDK: - 4.8.0 XCode: - 6.4,1.2斯威夫特

LoginViewController.swift

func loginButton(loginButton: FBSDKLoginButton!, 
    didCompleteWithResult 
    result: FBSDKLoginManagerLoginResult!, 
    error: NSError!) { 

     SVProgressHUD.showWithStatus(NSLocalizedString("LOGIN_PROGRESS_MSG", comment: "")) 

     if (error != nil) { 
      DDLogError("FB Login error: \(error.localizedDescription)") 
      SVProgressHUD.showErrorWithStatus(NSLocalizedString(error.localizedDescription, comment: "")) 
     } else if result.isCancelled { 
      DDLogError("FB Login cancelled") 
      SVProgressHUD.showErrorWithStatus(NSLocalizedString("Login cancelled", comment: "")) 
     } else { 
      DDLogDebug("FB Login success") 
      SVProgressHUD.showWithStatus(NSLocalizedString("FB_USER_FETCH_MSG", comment: "")) 
      returnUserData() 
     } 
} 

Appdelegate.swift

let fbLaunch = FBSDKApplicationDelegate.sharedInstance().application(application, 
      didFinishLaunchingWithOptions: launchOptions) // Added this method in didFinishLaunchingWithOptions method 

還實施

func application(application: UIApplication, 
    openURL url: NSURL, 
    sourceApplication: String?, 
    annotation: AnyObject?) -> Bool { 
     return FBSDKApplicationDelegate.sharedInstance().application(
      application, 
      openURL: url, 
      sourceApplication: sourceApplication, 
      annotation: annotation) 
} 

func applicationDidBecomeActive(application: UIApplication) { 
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 
    LocationManager.sharedInstance.startLocationManger() 
    FBSDKAppEvents.activateApp() 
    //Send device token change 
    APNSManager.validateAndUpdateAPNSToken() 

    //Look for APNS payload in background if we have saved any 
    APNSManager.handlePendningAPNSPayloads() 
} 

回答

0

嘗試表示主隊列SVProgressHUD從塊

dispatch_async(dispatch_get_main_queue(), { 
      SVProgressHUD.showWithStatus(NSLocalizedString("LOGIN_PROGRESS_MSG", comment: "")) 

      }) 
+2

我已經試過這個。但不工作 –

1

Svprogresshud不是在繁重的任務的情況下,示出了調用延遲之後執行上主要thread.showing裝載機時4毫秒將解決問題

DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(400)) { 
      SVProgressHUD.show() 
     } 
相關問題