Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion NSObject+Properties.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ - (NSDictionary *)dynamicProperties {
NSDictionary* properties = [self properties];
for (NSString* key in properties) {
NSArray* attributes = properties[key][@"attributes"];
if ([attributes containsObject:@"D"]) {
if ([attributes containsObject:@"D"] && ![attributes containsObject:@"C"]) {
output[key] = properties[key];
}
}
Expand Down
27 changes: 15 additions & 12 deletions PFFile+NSCoding.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,27 @@ @implementation PFFile (NSCoding)

- (void)encodeWithCoder:(NSCoder*)encoder
{
[encoder encodeObject:self.name forKey:kPFFileName];
[encoder encodeObject:self.name forKey:kPFFileName];
[encoder encodeObject:self.url forKey:kPFFileURL];
if (self.isDataAvailable) {
[encoder encodeObject:[self getData] forKey:kPFFileData];
}
if (self.isDataAvailable) {
[encoder encodeObject:[self getData] forKey:kPFFileData];
}
}

- (id)initWithCoder:(NSCoder*)aDecoder
{
NSString* name = [aDecoder decodeObjectForKey:kPFFileName];
NSString* name = [aDecoder decodeObjectForKey:kPFFileName];
NSString* url = [aDecoder decodeObjectForKey:kPFFileURL];
NSData* data = [aDecoder decodeObjectForKey:kPFFileData];

self = [PFFile fileWithName:name data:data];
if (self) {
[self setValue:url forKey:@"_url"];
}
return self;
NSData* data = [aDecoder decodeObjectForKey:kPFFileData];

if (data) {
self = [PFFile fileWithName:name data:data];
if (self) {
[self setValue:url forKey:@"_url"];
}
return self;
}
return nil;
}

@end
4 changes: 3 additions & 1 deletion PFObject+NSCoding.m
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ - (id)initWithCoder:(NSCoder*)aDecoder
//Deserialize all non-nil Parse properties
for (NSString* key in allKeys) {
id obj = [aDecoder decodeObjectForKey:key];
self[key] = obj;
if (obj) {
self[key] = obj;
}
}

//Deserialize all nil Parse properties with NSNull
Expand Down