diff --git a/PFFile+NSCoding.m b/PFFile+NSCoding.m index 5f7422d..20f78f9 100644 --- a/PFFile+NSCoding.m +++ b/PFFile+NSCoding.m @@ -29,8 +29,14 @@ - (id)initWithCoder:(NSCoder*)aDecoder NSString* name = [aDecoder decodeObjectForKey:kPFFileName]; NSString* url = [aDecoder decodeObjectForKey:kPFFileURL]; NSData* data = [aDecoder decodeObjectForKey:kPFFileData]; - - self = [PFFile fileWithName:name data:data]; + if (!data) { + self = [[PFFile alloc]init]; + [self setValue:name forKey:kPFFileName]; + } + else + { + self = [PFFile fileWithName:name data:data]; + } if (self) { [self setValue:url forKey:@"_url"]; } diff --git a/PFObject+NSCoding.m b/PFObject+NSCoding.m index 835f463..b4a9abe 100644 --- a/PFObject+NSCoding.m +++ b/PFObject+NSCoding.m @@ -53,7 +53,7 @@ - (id)initWithCoder:(NSCoder*)aDecoder NSArray* allKeys = [aDecoder decodeObjectForKey:kPFObjectAllKeys]; BOOL isDataAvailable = [aDecoder decodeBoolForKey:kPFObjectIsDataAvailableKey]; - if ([self isMemberOfClass:[PFObject class]]) { + if ([self isKindOfClass:[PFObject class]]) { //If this is a PFObject, recreate the object using the Parse class name and objectId self = [PFObject objectWithoutDataWithClassName:parseClassName objectId:objectId]; }