[QBRequest signUp: user successBlock: ^ (QBResponse * response, QBUUser * user) {
// your file - this is an image in our case
NSData * imageData = UIImageJPEGRepresentation([UIImage imageNamed: @"Profile Picture"], 0.8 f);
[QBRequest TUploadFile: imageData fileName: @"ProfilePicture"
contentType: @"image/jpeg"
isPublic: YES successBlock: ^ (QBResponse * response, QBCBlob * blob) {
// File uploaded, do something
// if blob.isPublic == YES
NSString * url = [blob publicUrl];
}
statusBlock: ^ (QBRequest * request, QBRequestStatus * status) {
// handle progress
}
errorBlock: ^ (QBResponse * response) {
NSLog(@"error: %@", response.error);
}
];
I have been trying to sing up a user, and upload an profile image but can not figure out the right way to do it. Do I have to upload it to custom data, or content module??? I already have a field created in CustomData. The code is running the file is getting saved somewhere but i don know where.
What am I missing, please help>about to go crazy>>>thank you
After you uploaded your picture (TUploadFile), in successBlock set [blob ID] to your QBUUser blobID property. After that just perform update user:
QBUpdateUserParameters *params = [QBUpdateUserParameters new];
params.blobID = [blob ID];
[QBRequest updateCurrentUser:params successBlock:^(QBResponse * _Nonnull response, QBUUser * _Nullable user) {
// success block
} errorBlock:^(QBResponse * _Nonnull response) {
// error block
NSLog(@"Failed to update user: %@", [response.error reasons]);
}];