Question: how stop duplicate entry of custom object in quickblox using custom field

Question

how stop duplicate entry of custom object in quickblox using custom field

Answers 1
Added at 2016-12-31 07:12
Tags
Question

I have some field like email,gcmid,deviceid etc. Now i want to only one entry per email Means email must be unique in custom Object(Class) of QuickBlox.

Answers
nr: #1 dodano: 2016-12-31 07:12

This code for ios. you can convert into java.

 [QBRequest logInWithSocialProvider:@"facebook" accessToken:strTokenString accessTokenSecret:nil successBlock: ^(QBResponse *response , QBUUser *user)
    {
        user.password = [QBSession currentSession].sessionDetails.token;
        NSMutableDictionary *dictParam = [[NSMutableDictionary alloc]init];
        [dictParam setValue:[NSString stringWithFormat:@"%lu",(unsigned long)user.ID ]forKey:@"user_id"];
        [QBRequest objectsWithClassName:@"UserData" extendedRequest:dictParam successBlock:^(QBResponse *response , NSArray *arrCustomObjects , QBResponsePage *page)
         {
             if(arrCustomObjects != nil && arrCustomObjects.count>0)
             {

             }
             else
             {

                 QBCOCustomObject *customObject = [[QBCOCustomObject alloc]init];
                 customObject.className = @"UserData";
                 [QBRequest createObject:customObject successBlock:^(QBResponse *response , QBCOCustomObject *object)
                 {
                     if (object != nil)
                     {
                         NSMutableDictionary *dictUserDetails = [[NSMutableDictionary alloc]init];
                         dictUserDetails setObject:strFirstName forKey:@"firstName"
                      object.className = @"UserData";
                      object.fields =



                     }

                  }errorBlock:^(QBResponse *errorResponse)
                  {
                      [hud hide:YES];
                  }];
             }
         }
         errorBlock:^(QBResponse *errorResponse)
         {
             [hud hide:YES];
         }];
    }
    errorBlock:^(QBResponse *errorResponse)
    {
        [hud hide:YES];
    }];
Source Show
◀ Wstecz