ios - 解析iOS初学者: getting an exception on PFUser signup

标签 ios parse-platform

我对 iOS 开发和 Parse 都相当陌生。我正在浏览解析文档,并尝试构建一个与我的项目相关的概念验证应用程序。 https://parse.com/docs/ios_guide#users-props/iOS

以下代码直接来自指南:

- (void)myMethod {
    PFUser *user = [PFUser user];
    user.username = @"my name";
    user.password = @"my pass";
    user.email = @"email@example.com";

    // other fields can be set just like with PFObject
    [user setObject:@"415-392-0202" forKey:@"phone"];

    [user signUpInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
      if (!error) {
          // Hooray! Let them use the app now.
      } else {
          NSString *errorString = [[error userInfo] objectForKey:@"error"];
          // Show the errorString somewhere and let the user try again.
      }
    }];
}

我已将此方法集成到我的应用程序中,运行它会引发以下异常:

-[PFObject setIsCurrentUser:]: unrecognized selector sent to instance 0x8b63be0
2013-07-02 21:50:00.147 signuptest[58478:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[PFObject setIsCurrentUser:]: unrecognized selector sent to instance 0x8b63be0

我希望更熟悉 Parse 的人可以在这里为我指明正确的方向。我已经深入研究了 api,但没有在任何地方看到 PFObject 的 setIsCurrentUser: 方法。

我的最终目标是基本上创建 PFUser 对象并使用上述方法将其保存在 Parse 数据库中。 有谁知道为什么会抛出该异常?如果需要,我可以提供测试应用程序的完整代码。

最佳答案

所以我终于弄清楚问题出在哪里了。以前在同一个项目中,我对 PFUser 进行了子类化对象使用 MyUser对象类并已使用 parse 注册该子类。后来我删除了子类并恢复到原来的PFUser我的应用程序的对象。然而 XCode 缓存了以前的构建配置并继续使用它们。因此我在服务器上发现实例不匹配。该方法本身运行良好。

解决办法: 以此作为引用清除缓存和任何旧的构建文件: How to Empty Caches and Clean All Targets Xcode 4

我希望这对将来遇到同样问题的人有所帮助。

关于ios - 解析iOS初学者: getting an exception on PFUser signup,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17438601/

相关文章:

ios - 被管理对象什么时候真正保存?

ios - 为什么图像显示在 UITabBar 中,在选定的项目上,不正确?

javascript - Parse.com CloudCode 使用用户名参数找到 Parse.User objectId

iphone - 如何摆脱 UIWebView 中嵌入的 youtube 视频周围的白色边框?

ios - 在 TableView 中按月份倒序

ios - 如何根据其中的元素更改 UIView 高度

android - 如何使用 parse.com android 从不同的表中获取 ObjectId

ios - 如何从地理点检索位置-(Parse.com 和 Swift)并使用 Xcode 6.2 在 map 上显示它

ios - 使用选定键的 Parse.com 关系查询

Android 解析推送通知很慢?