【问题标题】:how to handle 'Invalid token error :209' after parse migration objective c解析迁移目标 c 后如何处理“无效令牌错误:209”
【发布时间】:2016-09-15 06:44:00
【问题描述】:

如何在我使用以下代码的代码中处理此错误“无效会话错误 (209)”:

PFQuery *query = [PFQuery queryWithClassName:@"Query"];
[query whereKey:@"user" equalTo:[PFUser currentUser]];
[query whereKey:@"converted" equalTo:@NO];
query.cachePolicy = kPFCachePolicyNetworkElseCache;
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error)
{ if (!error){ // success }
else { [ParseErrorHandlingController handleParseError:error];}}

【问题讨论】:

  • 在 appdelegate.m 我已经使用了这个代码:
  • 可能注销再登录
  • [Parse initializeWithConfiguration:[ParseClientConfiguration configurationWithBlock:^(id configuration) { configuration.applicationId = @"App_ID"; configuration.clientKey = @"Client_Id"; configuration.server = @"parseapi.back4app.com"; }]]; [PFUser enableRevocableSessionInBackground];
  • 我已按照以下步骤操作:
  • e.在数据浏览器上,手动删除 Session 对象。这会撤销您手机上的会话令牌。 F。导航到应用程序中发出 Parse Query 的任何部分。这应该会抛出“无效会话令牌”错误并从步骤 1 调用您的错误处理逻辑。确保您的错误处理逻辑按预期工作。 G。再次登录您的应用程序并确保该应用程序仍然正常运行。数据浏览器现在应该显示 1 个会话。 H。退出您的应用程序。数据浏览器的会话表现在应该是空的。

标签: ios objective-c parse-platform back4app


【解决方案1】:

对于我可以在 Back4App 和 Parse 的文档中查看的内容,我会指出两个问题,您可能已经给出了您帖子中显示的代码。

首先,您使用的 SDK 初始化可能会出现一些拼写错误或语法问题,您可以查看 B4A 文档建议的内容:

[Parse initializeWithConfiguration:[ParseClientConfiguration configurationWithBlock:^(id<ParseMutableClientConfiguration> configuration) {
   configuration.applicationId = @"YOUR_APP_ID";
   configuration.clientKey = @"YOUR_CLIENT_KEY";
   configuration.server = @"https://parseapi.back4app.com";
   configuration.localDatastoreEnabled = YES; // If you need to enable local data store
}]];

然后,我在您的 if-else 子句中发现了一个错字,因为您在添加评论时没有关闭“if”部分,这里:

[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error)
{ if (!error){ // success }
else { [ParseErrorHandlingController handleParseError:error];}}

也许这些是您的问题的主要原因。

【讨论】:

    猜你喜欢
    • 2015-06-08
    • 1970-01-01
    • 2012-12-10
    • 1970-01-01
    • 2015-11-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多