Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to save a class on Parse

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 302
    Comment on it

    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)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: