【问题标题】:Error Domain=NSCocoaErrorDomain Code=3840错误域=NSCocoaErrorDomain 代码=3840
【发布时间】:2017-06-16 21:44:49
【问题描述】:

我知道许多其他人也有同样的问题,并且有很多问题具有相同的主题/标题。但是这些都没有解决我的问题。

我正在使用解析云代码和 Facebook 登录。但是由于 parse 关闭,我将代码移至 back4app。

这是移至我自己的服务器后的 Parse 初始化:

[Parse initializeWithConfiguration:[ParseClientConfiguration configurationWithBlock:^(id<ParseMutableClientConfiguration> configuration) {
    configuration.applicationId = @"ParseApplicationId";
    configuration.clientKey = @"ParseClientKey";
    configuration.server = @"https://parseapi.back4app.com";
}]];

当我尝试使用PFLogInViewController 登录时,在 Facebook 登录后调用委托方法:

- (void)logInViewController:(PFLogInViewController *)logInController didFailToLogInWithError:(NSError *)error

我收到此错误:

Error Domain=NSCocoaErrorDomain Code=3840 "JSON 文本没有开始 带有数组或对象以及允许未设置片段的选项。” UserInfo={NSDebugDescription=JSON 文本不是以数组开头或 允许未设置片段的对象和选项。}

使用PFLogInViewController 登录与我的云代码无关,因为它完全由 Parse SDK 处理。

此错误的可能原因是什么。如果您需要任何进一步的代码 sn-p,我也可以提供。

谢谢

【问题讨论】:

标签: ios objective-c facebook parse-platform


【解决方案1】:

好的,我解决了。就我而言,我的解析初始化应该是这样的:

[Parse initializeWithConfiguration:[ParseClientConfiguration configurationWithBlock:^(id<ParseMutableClientConfiguration> configuration) {
    configuration.applicationId = ParseApplicationId;
    configuration.clientKey = ParseClientKey;
    configuration.server = @"https://parseapi.back4app.com";
}]];

ParseApplicationIdParseClientKey 是常量,我错误地作为字符串传递。

如果有人使用自己的服务器来托管解析云服务器,请记住您的服务器不应阻止 graph.facebook.com。我的本地服务器允许facebook.com,但仍然阻止graph.facebook.com,花了一天多的时间才找到解决方案。

另外,您不能像以前一样保存PFUser,您可能必须将useMasterKey 添加为true。这些与我的问题无关,但我想知道是否有人可能会遇到这些问题。

【讨论】:

    猜你喜欢
    • 2018-04-08
    • 2015-03-11
    • 2020-03-14
    • 2016-02-26
    • 1970-01-01
    • 2016-07-10
    • 1970-01-01
    • 1970-01-01
    • 2014-11-02
    相关资源
    最近更新 更多