PFFacebookUtils.initializeFacebookWithApplicationLaunchOptions(launchOptions) 给出编译错误 [英] PFFacebookUtils.initializeFacebookWithApplicationLaunchOptions(launchOptions) giving compilation error

查看:19
本文介绍了PFFacebookUtils.initializeFacebookWithApplicationLaunchOptions(launchOptions) 给出编译错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将 facebook 登录集成到我的解析应用程序中.我遵循了解析教程中提到的每一步.在下面的代码中,我收到了编译错误.

I'm trying to integrate facebook login in my parse application. I followed every step mentioned in parse tutorial. In the below code, I'm getting compilation error.

 func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    // Override point for customization after application launch.
    line1: Parse.setApplicationId("xxx", clientKey: "yyy")
    line2: PFFacebookUtils.initializeFacebookWithApplicationLaunchOptions(launchOptions)       
    line3: PFAnalytics.trackAppOpenedWithLaunchOptions(launchOptions)
    line4: return true
}

第 3 行,出现错误:

可选类型[NSObject:AnyObject]"的值未解包;你是否意思是使用 '!' 或 '?'?

Value of optional type '[NSObject:AnyObject]' not unwrapped; did you mean to use '!' or '?'?

如果我使用 '!' 手动解开它,因为 launchOptions 可以为零,我得到:

If I manually unwrap it using '!', because launchOptions can be nil, I get:

致命错误:解包可选值时意外发现 nil

Fatal error: unexpectedly found nil while unwrapping an Optional value

如果我检查 nil,我得到:

If I check for nil, I get:

NSInternalInconsistencyException',原因:'你必须初始化PFFacebookUtils 调用+initializeFacebookWithApplicationLaunchOptions

NSInternalInconsistencyException', reason: 'You must initialize PFFacebookUtils with a call to +initializeFacebookWithApplicationLaunchOptions

知道如何修复它吗?

推荐答案

这是 ParseSDK 中的一个错误.在 Parse 解决此问题之前,您可以更改 PFFacebookUtils.h 头文件中的初始化函数声明

It is a bug in ParseSDK. Until Parse fix this you can change the initialize function declaration at PFFacebookUtils.h header file

1) 转到 PFFacebookUtils.h

1) Go to PFFacebookUtils.h

2) 改变:

  • (void)initializeFacebookWithApplicationLaunchOptions:(NSDictionary *)launchOptions;

致:

  • (void)initializeFacebookWithApplicationLaunchOptions:(PF_NULLABLE NSDictionary *)launchOptions;

此答案由 Kiarash Akhlaghi 在 https://developers.facebook.com/bugs/1462780714012820/ 提供

This answer was provided by Kiarash Akhlaghi at https://developers.facebook.com/bugs/1462780714012820/

这篇关于PFFacebookUtils.initializeFacebookWithApplicationLaunchOptions(launchOptions) 给出编译错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆