简体   繁体   English

PFFacebookUtils.initializeFacebookWithApplicationLaunchOptions(launchOptions)给出编译错误

[英]PFFacebookUtils.initializeFacebookWithApplicationLaunchOptions(launchOptions) giving compilation error

I'm trying to integrate facebook login in my parse application. 我正在尝试将facebook登录集成到我的解析应用程序中。 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
}

In line 3 , I'm getting error: 第3行 ,我收到错误:

Value of optional type ' [NSObject:AnyObject] ' not unwrapped; 可选类型' [NSObject:AnyObject] '的值[NSObject:AnyObject]包; did you mean to use ' ! 你的意思是用' ! ' or ' ? '或' ? '? “?

If I manually unwrap it using ' ! 如果我使用'手动打开它! ', because launchOptions can be nil, I get: ',因为launchOptions可能是零,我得到:

Fatal error: unexpectedly found nil while unwrapping an Optional value 致命错误:在展开Optional值时意外发现nil

If I check for nil, I get: 如果我检查无,我得到:

NSInternalInconsistencyException ', reason: 'You must initialize PFFacebookUtils with a call to +initializeFacebookWithApplicationLaunchOptions NSInternalInconsistencyException ',原因:'你必须通过调用+initializeFacebookWithApplicationLaunchOptions初始化PFFacebookUtils

Any idea how to fix it? 知道怎么解决吗?

It is a bug in ParseSDK. 这是ParseSDK中的一个错误。 Until Parse fix this you can change the initialize function declaration at PFFacebookUtils.h header file 在Parse修复​​此问题之前,您可以在PFFacebookUtils.h头文件中更改初始化函数声明

1) Go to PFFacebookUtils.h 1)转到PFFacebookUtils.h

2) change: 2)改变:

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

To: 至:

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

This answer was provided by Kiarash Akhlaghi at https://developers.facebook.com/bugs/1462780714012820/ 这个答案由Kiarash Akhlaghi提供,网址是https://developers.facebook.com/bugs/1462780714012820/

The problem was a bug of ParseSDK, it does not accept nil launchOptions 问题是ParseSDK的一个错误,它不接受nil launchOptions

According to the the answer provided by Roger Ingouacka at https://developers.facebook.com/bugs/1462780714012820/ 根据Roger Ingouacka在https://developers.facebook.com/bugs/1462780714012820/提供的答案

    if let launchOptions = launchOptions {
        PFFacebookUtils.initializeFacebookWithApplicationLaunchOptions(launchOptions)
    } else {
        PFFacebookUtils.initializeFacebookWithApplicationLaunchOptions([NSObject:AnyObject]())
    }

Notice the use of 注意使用

[NSObject:AnyObject]()

This problem persisted untill I updated to Parse library 1.8.1 . 这个问题一直存在,直到我更新到Parse库1.8.1

I tried adjusting PFFacebookUtils.h, and a lot of other things, but that did not solve it. 我尝试调整PFFacebookUtils.h以及其他很多东西,但这并没有解决它。 It was driving me insane. 这让我疯了。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 PFFacebookUtils.initializeFacebookWithApplicationLaunchOptions(launchOptions)挂起app - PFFacebookUtils.initializeFacebookWithApplicationLaunchOptions(launchOptions) hangs app 使用[PFFacebookUtils initializeFacebookWithApplicationLaunchOptions:launchOptions](semaphore_wait_slow陷阱)解析自Facebook 4.0.x以来的登录挂起 - Parse login hang since Facebook 4.0.x with [PFFacebookUtils initializeFacebookWithApplicationLaunchOptions:launchOptions] (semaphore_wait_slow trap) PFFacebookUtils initializeFacebookWithApplicationLaunchOptions冻结应用程序(信号等待陷阱) - PFFacebookUtils initializeFacebookWithApplicationLaunchOptions freezes app (semaphore wait trap) 错误您必须初始化PFFacebookUtils - Error You must initialize PFFacebookUtils PFFacebookUtils- - PFFacebookUtils - 带有最新解析库的Xcode 8.2中的PFFacebookUtils.h编译错误 - PFFacebookUtils.h compilation errors in Xcode 8.2 with latest parse libraries 在PFFacebookUtils.logInWithPermissions行中错误使用未解析的标识符'PFFacebookUtils' - Error Use of unresolved identifier 'PFFacebookUtils' in line PFFacebookUtils.logInWithPermissions PFAnalytics.trackAppOpenedWithLaunchOptions中的错误(launchOptions,块:无) - Error in PFAnalytics.trackAppOpenedWithLaunchOptions(launchOptions, block: nil) 尝试使用Parse PFFacebookUtils登录Facebook时收到错误307 - Getting Error 307 when trying to login with Facebook using Parse PFFacebookUtils 没有这样的模块“ PFFacebookUtils” - No such module 'PFFacebookUtils'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM