Parse 和 Facebook 的问题
Posted
技术标签:
【中文标题】Parse 和 Facebook 的问题【英文标题】:Issue with Parse & Facebook 【发布时间】:2015-06-10 15:16:40 【问题描述】:我开始使用 Parse 和 Facebook 开发应用程序。 我已经添加了两个 SDK。
这是我的 ViewController 代码(fbLogIn 是“连接 Facebook”的按钮):
class ViewController: UIViewController
override func viewDidLoad()
super.viewDidLoad()
override func didReceiveMemoryWarning()
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
@IBAction func fbLogIn(sender: AnyObject)
var permissions = ["email"]
PFFacebookUtils.logInInBackgroundWithReadPermissions(permissions)
(user: PFUser?, error: NSError?) -> Void in
if let user = user
if user.isNew
println("User signed up and logged in through Facebook!")
else
println("User logged in through Facebook!")
else
println("Uh oh. The user cancelled the Facebook login.")
这是 App Delegate 代码:
import UIKit
import Parse
import Bolts
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool
// Override point for customization after application launch.
Parse.setApplicationId("*Cencored ID*",
clientKey: "*Cencored clientkey*")
PFFacebookUtils.initializeFacebookWithApplicationLaunchOptions(launchOptions)
return true
func applicationWillResignActive(application: UIApplication)
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
func applicationDidEnterBackground(application: UIApplication)
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
func applicationWillEnterForeground(application: UIApplication)
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
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.
FBSDKAppEvents.activateApp()
func applicationWillTerminate(application: UIApplication)
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
func application(application: UIApplication,
openURL url: NSURL,
sourceApplication: String?,
annotation: AnyObject?) -> Bool
return FBSDKApplicationDelegate.sharedInstance().application(application,
openURL: url,
sourceApplication: sourceApplication,
annotation: annotation)
这是错误: http://i.imgur.com/GZtyG3k.png
我能做些什么来解决它?
【问题讨论】:
【参考方案1】:我也有类似的经历。查看项目中的框架,检查是否有 ParseFacebookUtils.framework 和 ParseCrashReporting.framework。如果这样做,请将它们从您的项目中删除。不过你需要 ParseFacebookUtilsV4.framework,所以把它留在那里。
【讨论】:
太棒了!有用!我按你说的删除了,Clean, Build % Run!以上是关于Parse 和 Facebook 的问题的主要内容,如果未能解决你的问题,请参考以下文章
Parse 和 Facebook 的问题 - 无法识别应用程序
使用 Swift 使用 Parse 存储和保存 Facebook 数据
验证有效的 Parse 和 Facebook 会话,同时还允许在没有 Facebook 的情况下注册