Swift 当我尝试在我的应用程序中登录Facebook时,我得到一个;消息=";调用了应用程序id 1xxxxxx的(#100)图形API,但令牌的应用程序id为4xxx851“&引用;错误
我研究了一些关于这个错误的帖子 他们的回答不起作用。 我确实在p.list中正确地输入了代码, 我也没有在CbundleUrlSchems键之间放置空格 我的问题是Swift 当我尝试在我的应用程序中登录Facebook时,我得到一个;消息=";调用了应用程序id 1xxxxxx的(#100)图形API,但令牌的应用程序id为4xxx851“&引用;错误,swift,parse-platform,facebook-login,Swift,Parse Platform,Facebook Login,我研究了一些关于这个错误的帖子 他们的回答不起作用。 我确实在p.list中正确地输入了代码, 我也没有在CbundleUrlSchems键之间放置空格 我的问题是 此错误消息是关于什么的 我怎样才能解决这个问题 如果你需要代码,只需评论我,我会留在这篇文章 ////我又做了一次,这次我发现显示器什么也不显示,当我触摸它时,它会给我 2015-09-21 01:08:40.179 NoNa_应用程序[3077:593233]中出现意外的零窗口 _UIApplicationHandleEventF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fb1686xxxxxx0</string>
</array>
</dict>
</array>
<key>FacebookAppID</key>
<string>1686xxxxx00</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>
CbundleurlTypes
循环流化床锅炉方案
fb1686xxxxxx0
FacebookAppID
1686XXXX000
FacebookDisplayName
班尼
NSAppTransportSecurity
NSExceptionDomains
facebook.com
n包括多个域
NSExceptionRequiresForwardSecretary
fbcdn.net
n包括多个域
NSExceptionRequiresForwardSecretary
akamaihd.net
n包括多个域
NSExceptionRequiresForwardSecretary
LSApplicationQueriesSchemes
fbapi
fb messenger api
fbauth2
fbshareextension
CfBundledDevelopmentRegion
EN
Cbundlexecutable
$(可执行文件名称)
CbundleIdentifier
$(产品\捆绑包\标识符)
CbundleInfo字典版本
6
CFBundleName
$(产品名称)
CbundlePackageType
BNDL
CbundleShortVersionString
1
CFBundleSignature
????
循环流化床锅炉
1.
我的登录页面是
import UIKit
import Parse
class CustomLoginViewController: UIViewController {
@IBAction func facebookLogin(sender: AnyObject) {
@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()
}
})
}
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}
导入UIKit
导入解析
类CustomLoginViewController:UIViewController{
@iAction func facebookLogin(发件人:AnyObject){
@iAction func facebookLogin(发件人:AnyObject){
PFFacebookUtils.LoginBackgroundWithReadPermissions([“公共_配置文件”、“电子邮件”]){
(用户:PFUser?,错误:NSError?->在中无效
如果(FBSDKAccessToken.currentAccessToken()!=nil)
{
让mainPage=self.storyboard?.instanceeviewcontrollerwhiteIdentifier(“MainHomeTVC”)作为!MainHomeTVC
让mainPageNav=UINavigationController(rootViewController:mainPage)
让appDelegate=UIApplication.sharedApplication()。委托为!appDelegate
appDelegate.window?.rootViewController=mainPage
}
//如果let user=user{
//如果user.isNew{
打印(“用户注册并通过Facebook登录!”)
//}其他{
打印(“用户通过Facebook登录!”)
// }
//}否则{
//打印(“哦,用户取消了Facebook登录。”)
// }
}
}
@ibvar usernameField:UITextField!
@IBOUTLE弱var密码字段:UITextField!
变量actInd:UIActivityIndicatorView=UIActivityIndicatorView(框架:CGRectMake(0,0,150,150))作为UIActivityIndicatorView
重写func viewDidLoad(){
super.viewDidLoad()
self.actInd.center=self.view.center
self.actInd.hidesWhenStopped=true
self.actInd.activityIndicatorViewStyle=UIActivityIndicatorViewStyle.Gray
view.addSubview(self.actInd)
}
重写函数didReceiveMemoryWarning(){
超级。我收到了记忆警告()
//处置所有可以重新创建的资源。
}
@iAction func loginAction(发件人:AnyObject){
让username=self.usernameField.text
让password=self.passwordField.text
如果(用户名?.utf16.count<4 | |密码?.utf16.count<5){
let alert=UIAlertView(标题:“无效”,消息:“用户名必须大于4,密码必须大于5”,代理:self,取消按钮:“确定”)
alert.show()
}否则{
self.actInd.startAnimating()
PFUser.logInWithUsernameInBackground(username!,password:password!,block:{(user,error)->Void in
self.actInd.stop设置动画()
如果((用户)!=nil){
let alert=UIAlertView(标题:“成功”,消息:“登录”,代表:自我,取消按钮:“确定”)
alert.show()
}否则{
let alert=UIAlertView(标题:“错误”,消息:“\(错误)”,委托:自我,取消按钮:“确定”)
alert.show()
}
})
}
}
/*
//标记:-导航
//在基于故事板的应用程序中,您通常需要在导航之前做一些准备
覆盖函数prepareforsgue(segue:UIStoryboardSegue,sender:AnyObject?){
//使用segue.destinationViewController获取新的视图控制器。
//将选定对象传递给新的视图控制器。
}
*/
}
015-09-20 23:41:17.210 NoNa_应用程序[2562:524339]在应用程序HandleEventFromQueueEvent中出现意外的零窗口,\u WindowsServerHitTestWindow:2015-09-20 23:41:28.755 NoNa_应用程序[2562:524339]FBSDKLog:未能发送事件:错误域=com.facebook.sdk.core code=8”(null)---这是我的编辑器(?)告诉我有关错误请给我相关代码。015-09-20 23:41:17.210 NoNa_应用程序[2562:524339]Inou UIApplicationHandleEventFromQueueEvent,\u WindowsServerHitTestWindow:2015-09-20 23:41:28.755 NoNa_应用程序[2562:524339]FBSDKLog:发送上诉失败:错误域=com.facebook.sdk.core code=8”(空)------这是我的编辑器(?)关于错误的第一行,请给我相关代码。