0

PFObject (Parse.com) のサブクラスであるクラスを作成しています。

例: LBSomeClass.h

@interface LBSomeClass : PFObject
@propertise (strong,nonatomic) NSString* prop1;
@propertise (strong,nonatomic) NSString* prop2;
-(id)init;
-(id)initWithId:(NSString*)uid;
@end

LBSomeClass.m

@implementation LBPhoto
@synthesize prop1;
@synthesize prop2;

-(id)init {
self = [super init];
return self;
}

-(id)initWithId:(NSString*)uid {
self = [super init];
PFQuery* query = [PFQuery queryWithClassName:@"someclass"];
self = (LBSomeClass*)[query getObjectWithId:uid];

self.prop1 = [self objectForKey:@"propertiseone"]; //error here
self.prop2 = [self objectForKey:@"propertisetwo"]; //error here

return self;
}

しかし、私が実行すると、いくつかのエラーがあります:

[PFObject setProp1:]: unrecognized selector sent to instance 0xa2707d0
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[PFObject setProp1:]: unrecognized selector sent to instance 0xa2707d0'

それを解決するのを手伝ってもらえますか? 本当にありがとう!!!

問題が解決しました!!!

-(id)initWithId:(NSString*)uid {
self = [super initWithClassName:@"Photo"];
[self setObjectId:targetID];

[self fetch];

self.prop1 = [self objectForKey:@"propertiseone"];
// other
}
4

2 に答える 2

0

問題は私が解決します(笑)

-(id)initWithId:(NSString*)uid {
self = [super initWithClassName:@"Photo"];
[self setObjectId:targetID];

[self fetch];

self.prop1 = [self objectForKey:@"propertiseone"];
// other
}
于 2013-01-11T14:57:00.123 に答える
-1

使用する@property (readwrite, retain)

于 2013-01-11T06:24:45.173 に答える