2015-12-17 2 views
1

J'utilise SVProgressHUD dans mon projet swift en tant que framework. Il fonctionne très bien dans iOS 8. Je me connecte avec Facebook dans mon application. chaque fois que j'utilise le login SVProgressHUD ne montre pas à travers l'application. Mais quand j'ai tué l'application et lancer SVProgressHUD fonctionnera bien. J'ai déjà ajouté les clés requises dans info.plist. Je suis incapable de comprendre le problème. S'il vous plaît, n'importe qui donne la solution.SVProgressHud ne s'affiche pas dans iOS 9 lorsque l'application utilise Connexion avec Facebook

Édition: si je change «loginbehaviour» en Web et SystemAccount. ça fonctionne bien.

Environnement FBSDK: - 4.8.0 XCode: - 6.4, Swift 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 

également mis en œuvre

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() 
} 

Répondre

0

essayer montrant SVProgressHUD dans la file principale lors de l'appel du bloc

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

      }) 
+2

J'ai déjà essayé cela. mais ne fonctionne pas –

1

Svprogresshud ne montre pas dans le cas d'une lourde tâche est d'effectuer sur chargeur principal de thread.showing après un délai de 4 ms va résoudre le problème

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