Hi guys ,
Here is a quick help of saving a class on parse cloud.
Download Parse FrameWork.
Import it.
ParseSave.m
NSMutableDictionary *dict=[[NSMutableDictionary alloc]initWithObjectsAndKeys:[data objectForKey:@"Id"],@"Id",[data objectForKey:@"name"],@"name",[data objectForKey:@"status"],@"status",[result objectId],@"objectId",[data objectForKey:@"installerId"],@"installerId",nil];
[[ParseHelper PFObjectFromDic:dict :@"fb_User"] saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
NSLog(@"Saved");
}];
ParseHelper.h
@interface ParseHelper : NSObject
+(PFObject<em>)PFObjectFromDic:(NSDictionary</em>)userdetail :(NSString*)tablename;
@end
ParseHelper.m
@implementation ParseHelper
+(PFObject*)PFObjectFromDic:(NSDictionary*)userdetail :(NSString*)tablename{
PFObject *newObj = [PFObject objectWithClassName:tablename];
[newObj.ACL setPublicWriteAccess:YES];
NSArray *allkeys=[userdetail allKeys];
NSArray *allvalues=[userdetail allValues];
int index=0;
for(NSString *key in allkeys){
newObj[key]=[allvalues objectAtIndex:index];
index++;
}
return newObj;
}
@end
0 Comment(s)