_UIApplicationHandleEventFromQueueEvent,_windowServerHitTestWindow中的意外nil窗口:

时间:2015-09-21 05:48:20

标签: swift parse-platform facebook-login

我尝试在登录页面中设置Facebook登录功能。 我第一次失败了,(这是我的代码)

When I try to make Facebook login in my app, I get a "message = "(#100) Graph API for app id 1XXXXXXXXX called, but token has app id 4xxxx851";" Error

然后我以同样的方式再次制作它,但这一次,我有一种不同类型的错误。

它可以构建,但不显示任何UI。显示只是黑色。

当我触摸显示的黑色显示时,

  

2015-09-21 01:42:34.419 NoNa_App [3327:624143]意外的无窗口   _UIApplicationHandleEventFromQueueEvent,_windowServerHitTestWindow :; layer =>

此。

我的p.list或代码有什么问题? 我该如何解决这个错误?

这是我的登录页面和p.list代码。

import UIKit
import Parse
class CustomLoginViewController: UIViewController {

@IBAction func facebookLogin(sender: AnyObject) {
    PFFacebookUtils.logInInBackgroundWithReadPermissions(["public_profile", "email"]) {
        (user: PFUser?, error: NSError?) -> Void in

        if(FBSDKAccessToken.currentAccessToken() != nil)
        {
            let mainPage = self.storyboard?.instantiateViewControllerWithIdentifier("MainHomeTVC") as! MainHomeTVC

            let mainPageNav = UINavigationController(rootViewController: mainPage)

            let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate

            appDelegate.window?.rootViewController = mainPage
        }

        //if let user = user {
         //   if user.isNew {
                print("User signed up and logged in through Facebook!")
         //   } else {
                print("User logged in through Facebook!")
          //  }
        //} else {
        //    print("Uh oh. The user cancelled the Facebook login.")
       // }
    }


}
@IBOutlet weak var usernameField: UITextField!
@IBOutlet weak var passwordField: UITextField!

var actInd : UIActivityIndicatorView = UIActivityIndicatorView(frame: CGRectMake(0, 0, 150, 150)) as UIActivityIndicatorView

override func viewDidLoad() {
    super.viewDidLoad()

self.actInd.center = self.view.center
    self.actInd.hidesWhenStopped = true
    self.actInd.activityIndicatorViewStyle = UIActivityIndicatorViewStyle.Gray

    view.addSubview(self.actInd)
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}

@IBAction func loginAction(sender: AnyObject) {

    let username = self.usernameField.text
    let password = self.passwordField.text

    if (username?.utf16.count < 4 || password?.utf16.count < 5) {
        let alert = UIAlertView(title: "Invalid", message: "Username must be greater then 4 and Password must be a greater then 5.", delegate: self, cancelButtonTitle: "OK")

        alert.show()
    } else {
        self.actInd.startAnimating()

        PFUser.logInWithUsernameInBackground(username!, password: password!, block: { (user, error) -> Void in
            self.actInd.stopAnimating()

            if((user) != nil) {

                let alert = UIAlertView(title: "Success", message: "Logged In", delegate: self, cancelButtonTitle: "OK")

                alert.show()

            }else {
                let alert = UIAlertView(title: "Error", message: "\(error)", delegate: self, cancelButtonTitle: "OK")

                alert.show()

            }

        })


    }

}
  }








     <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"              "h    ttp://www.apple.com/DTDs/PropertyList-1.0.dtd">  
<plist version="1.0">
    <dict>
        <key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>fb1686861514879500</string>
            </array>
        </dict>
    </array>
    <key>FacebookAppID</key>
    <string>16866861514879500</string>
    <key>FacebookDisplayName</key>
    <string>bany</string>
    <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSExceptionDomains</key>
        <dict>
            <key>facebook.com</key>
            <dict>
                <key>NSIncludesSubdomains</key>
                <true/>
                <key>NSExceptionRequiresForwardSecrecy</key>
                <false/>
            </dict>
            <key>fbcdn.net</key>
            <dict>
                <key>NSIncludesSubdomains</key>
                <true/>
                <key>NSExceptionRequiresForwardSecrecy</key>
                <false/>
            </dict>
            <key>akamaihd.net</key>
            <dict>
                <key>NSIncludesSubdomains</key>
                <true/>
                <key>NSExceptionRequiresForwardSecrecy</key>
                <false/>
            </dict>
        </dict>
    </dict>
    <key>LSApplicationQueriesSchemes</key>
    <array>
        <string>fbapi</string>
        <string>fb-messenger-api</string>
        <string>fbauth2</string>
        <string>fbshareextension</string>
    </array>
    <key>CFBundleDevelopmentRegion</key>
    <string>en</string>
    <key>CFBundleExecutable</key>
    <string>$(EXECUTABLE_NAME)</string>
    <key>CFBundleIdentifier</key>
    <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>$(PRODUCT_NAME)</string>
    <key>CFBundlePackageType</key>
    <string>BNDL</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleVersion</key>
    <string>1</string>
</dict>

0 个答案:

没有答案