- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在进行 Beta 测试,到目前为止,已有 5 位用户完全成功登录和使用该应用程序。但是,3 个用户的 Facebook 信息未保存到 Parse,并且当他们尝试转移到加载用户个人资料的 VC 时,应用程序崩溃。我不明白发生了什么事。这是我的登录代码,它会显得非常业余和困惑,所以预先道歉! (新手但正在尝试)应用程序委托(delegate):
import UIKit
import Bolts
import Parse
import ParseUI
import FBSDKCoreKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// code in here to check devices just left it out as it was too much information to paste.
}
// parse info and connection
Parse.enableLocalDatastore()
Parse.setApplicationId("",
clientKey: "")
PFFacebookUtils.initializeFacebookWithApplicationLaunchOptions(launchOptions)
PFUser.enableAutomaticUser()
let defaultACL = PFACL();
defaultACL.setPublicReadAccess(true)
PFACL.setDefaultACL(defaultACL, withAccessForCurrentUser:true)
if application.applicationState != UIApplicationState.Background {
let preBackgroundPush = !application.respondsToSelector("backgroundRefreshStatus")
let oldPushHandlerOnly = !self.respondsToSelector("application:didReceiveRemoteNotification:fetchCompletionHandler:")
var noPushPayload = false;
if let options = launchOptions {
noPushPayload = options[UIApplicationLaunchOptionsRemoteNotificationKey] != nil;
}
if (preBackgroundPush || oldPushHandlerOnly || noPushPayload) {
PFAnalytics.trackAppOpenedWithLaunchOptions(launchOptions)
}
}
if application.respondsToSelector("registerUserNotificationSettings:") {
let userNotificationTypes: UIUserNotificationType = [UIUserNotificationType.Alert, UIUserNotificationType.Badge, UIUserNotificationType.Sound]
let settings = UIUserNotificationSettings(forTypes: userNotificationTypes, categories: nil)
application.registerUserNotificationSettings(settings)
application.registerForRemoteNotifications()
} else {
let types: UIRemoteNotificationType = [UIRemoteNotificationType.Badge, UIRemoteNotificationType.Alert, UIRemoteNotificationType.Sound]
application.registerForRemoteNotificationTypes(types)
}
return FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)
}
func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {
let installation = PFInstallation.currentInstallation()
installation.setDeviceTokenFromData(deviceToken)
installation.saveInBackground()
PFPush.subscribeToChannelInBackground("") { (succeeded: Bool, error: NSError?) in
if succeeded {
print("ParseStarterProject successfully subscribed to push notifications on the broadcast channel.");
} else {
print("ParseStarterProject failed to subscribe to push notifications on the broadcast channel with error = %@.", error)
}
}
}
func application(application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: NSError) {
if error.code == 3010 {
print("Push notifications are not supported in the iOS Simulator.")
} else {
print("application:didFailToRegisterForRemoteNotificationsWithError: %@", error)
}
}
func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {
PFPush.handlePush(userInfo)
if application.applicationState == UIApplicationState.Inactive {
PFAnalytics.trackAppOpenedWithRemoteNotificationPayload(userInfo)
}
}
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) {
FBSDKAppEvents.activateApp()
}
}
查看 Controller :
import UIKit
import Parse
import FBSDKCoreKit
import FBSDKShareKit
import FBSDKLoginKit
import ParseUI
class LoginViewController: UIViewController {
var firstName: String!
var lastName: String!
@IBAction func logInWithFacebook(sender: AnyObject) {
let permissions = ["public_profile", "email"]
PFFacebookUtils.logInInBackgroundWithReadPermissions(permissions, block: {
(user: PFUser?, error: NSError?) -> Void in
if let error = error {
print(error)
} else {
// user successfully signed in:
if let user = user {
self.performSegueWithIdentifier("registerFacebookSegue", sender: self)
}
}
})
}
override func viewDidAppear(animated: Bool) {
//to log user out
// PFUser.logOut()
// segue if user is logged in:
if let username = PFUser.currentUser()?.username {
self.performSegueWithIdentifier("loggedInProfileSegue", sender: self)
}
}
override func viewDidLoad() {
super.viewDidLoad()
if(FBSDKAccessToken.currentAccessToken() != nil) {
print("user logged in")
} else {
print("user not logged in")
}
}
override func prefersStatusBarHidden() -> Bool {
return true
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
从无法正常工作的用户那里获取 Facebook 密码,并尝试使用 xcode 登录并且连接的手机出现此错误:
* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Can't use nil for keys or values on PFObject. Use NSNull for values.' * First throw call stack: (0x183608f48 0x1980cbf80 0x183608e90 0x1000e49a8 0x1000e8e98 0x10012d344 0x1000e8eec 0x100062ec8 0x1000976f4 0x10009e1c0 0x10009df90 0x10009da44 0x1834ff990 0x1834ff800 0x10009d800 0x10009cd00 0x10009aed4 0x100097eb8 0x100097e10 0x100098288 0x182e9b6a8 0x182e9b638 0x182e9b7ac 0x182d074fc 0x182df5b38 0x101461c68 0x10146b40c 0x182cf3ce4 0x1834ec6cc 0x182cf3bc8 0x182cf3a88 0x182cf38b4 0x1835c0544 0x1835bffd8 0x1835bdcd8 0x1834ecca0 0x18e728088 0x188c04ffc 0x10006e488 0x19891a8b8) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)
最佳答案
问题是我在请求中要求提供电子邮件,但并非所有 Facebook 帐户都有。 a. 有效的电子邮件地址和 b.任何链接的电子邮件地址。所以我不得不删除这个请求并要求用户单独输入他们的电子邮件地址。
关于ios - Beta 测试、Facebook 登录、Parse。某些用户的 Facebook 信息未保存到 Parse。 swift ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34159133/
我为我们的业务创建了一个 Facebook 页面,我创建了一个 Facebook 应用程序来获取 AppID,以便在 Facebook 插件中使用它。 我注意到 Facebook 应用程序的页面看起来
是否有可能知道哪个 Facebook 用户点击了我的应用用户在 Facebook 上分享的链接? 为了清楚起见,让我改写一下:我想知道我的应用用户的哪些 friend 点击了他的共享链接。 感谢任何提
我正在浏览 facebook pixel,对 facebook pixel 如何知道哪个转化来自哪个 facebook 广告感到很困惑? 假设我有这个 url http://example.com安装
我正在开发 sucsongmoi.net(越南语),当浏览者从他们的墙上分享网站链接时,一些链接 facebook 获得描述和图像,一些链接 facebook 无法获得描述和图像。 例如:分享 suc
一位同事错误地设置了个人 Facebook 页面;它应该是一个企业 Facebook 页面。 个人页面上有几个 friend 需要重定向到正确的 Facebook 业务页面。 我可以将用户从错误的个人
在 Facebook 上,当您转到“编辑我的个人资料”>“艺术和娱乐”时,会有一个“电影”自动完成小部件,它会在您输入电影时推荐电影。 因此,如果您输入“Jones”,它将开始建议: 印第安纳琼斯 布
我在我的网页上使用 Facebook 登录。首次登录时,Facebook 登录应用程序会请求获取用户数据的权限。 有什么方法可以改善这个问题,以请求喜欢我的 Facebook 页面的许可?用户点击后,
我需要知道是否可以将现有的 Facebook 页面(类别:应用程序页面)链接到 Facebook 应用程序?当我进入 Facebook 应用程序设置时,他们建议创建一个新页面。但我需要的只是链接到现有
我的网站应用程序具有通过 Facebook 登录进行登录的功能。为此,我的应用程序出现在 Facebook 上。使用 Facebook 登录工作正常。 但应用程序具有将 Facebook 帐户链接和取
我正在制作一个应用程序,让人们可以在 Facebook 上与特定的 friend 分享内容。示例:Alice 使用我的应用程序,她与 Bob 分享了一篇文章,Bob 是她的 Facebook 好友。现
我正在按照列出的说明进行操作 http://docs.appcelerator.com/platform/latest/#!/api/Modules.Facebook 并查看 Arrow 示例目录中的
假设我有一个餐厅的商业网站,一位顾客为一大群人预订了一张 table 。有没有一种方法可以让客户有机会在餐厅网站上创建 Facebook 事件,作为预订流程的一部分。我知道客户必须以某种方式从餐厅网站
我想让我的用户将他们的用户帐户与 Facebook 或 Twitter 相关联,并允许他们使用他们的 Facebook/Twitter 帐户登录我的服务器,而不是使用传统的用户名/密码。与StackO
我们有一个面子书页面。我们添加了一个自定义 FBML 选项卡。现在我们要添加评论面子书插件。我尝试添加一个脚本,我从 Face book Social Plug in .代码是 之后我将此脚本放入自
大家好 请帮我找到关于以下的官方信息: 1) 什么是“FaceBook 登录” 2) 什么是“FaceBook Connect” 谢谢 最佳答案 你可以在那里找到你需要的一切: http://deve
这是最奇怪的事情。我有非常简单的 CF 代码,查看 cgi.HTTP_REFERER。简单地说,它查看推荐人。如果链接是从我们的主要网站域之外单击的,它会显示一些内容。否则,什么也不会发生。所以,如果
我还是 Facebook Graph API 的新手,正在尝试开始使用 Facebook 地点搜索。 (按位置搜索地点) https://graph.facebook.com/search?type=
我不想开设 Facebook 帐户,但我被要求为需要使用 Facebook API 的应用程序开发功能。有没有一种方法可以开发这些功能并使用 Facebook API,而无需开设个人 Facebook
我已经按照指示实现了 DotNetOpenAuth 提供的示例应用程序 here . 正如您在下面看到的,这要求用户安装此 facebook 应用程序。 我只是想让用户使用他们的 Facebook 登
我的主页上有标准的 Facebook 登录按钮,我不希望人们仅在用户单击登录按钮时使用他们的 Facebook 帐户自动登录我的网站。 如果用户未登录 Facebook,将出现一个弹出窗口询问他的凭据
我是一名优秀的程序员,十分优秀!