【发布时间】:2014-12-26 20:25:29
【问题描述】:
我正在使用Parse.com,并且我有一个名为NPUser 的PFUser 子类。
代码如下:
NPUser.h
#import <Foundation/Foundation.h>
#import <Parse/Parse.h>
@interface NPUser : PFUser <PFSubclassing>
@property (nonatomic) NSString *facebookId;
- (NSURL *)profileImageURL;
@end
NPUser.m
#import "NPUser.h"
#import <Parse/PFObject+Subclass.h>
@implementation NPUser
@dynamic facebookId;
+ (void)load {
[self registerSubclass];
}
- (NSURL *)profileImageURL {
// -- This is where things blow up --
NSString *urlString = [NSString stringWithFormat:@"https://graph.facebook.com/%@/picture?type=large", self.facebookId];
return [NSURL URLWithString:urlString];
}
@end
当我致电profileImageURL 时,发生了一些奇怪的事情,似乎执行只是中止了,但应用程序并没有冻结。我在第一行设置了一个断点并将其缩小到 self.facebookId 失败。
当我打电话给self.facebookId 或self[@"facebookId"] 或[self objectForKey:@"facebookId"](我相信它们都是一样的)时,我得到了这个错误:
error: Execution was interrupted, reason: internal ObjC exception breakpoint(-3)..
The process has been returned to the state before expression evaluation.
我已经阅读了this question on Parse about subclassing PFUser,但我没有找到任何可以帮助我的东西。我还阅读了docs on subclassing PFObject 并遵循了那里所说的内容。
问题是所有功能都可以正常工作(我的NPUser 类似乎被正确调用并且它的所有属性都被正确设置)。当我检查 Parse.com 上的数据仪表板时,facebookId 属性也被正确保存。
我应该提到,当我检查被调用的用户对象时,它说它是 PFUser 而不是 NPUser,但 profileImageURL 方法(仅在 NPUser 中定义)确实被调用了。
我对此感到困惑。有什么想法或建议吗?
【问题讨论】:
标签: ios objective-c parse-platform pfuser