我正在嘗試使用Quickblox API下載圖像文件。我可以上傳文件,但是當我嘗試下載時,NSData
圖像不顯示圖像。如何使用QuickBox API下載圖像?
// Upload a user avatar, previously log in Quickblox API
NSData *avatar = UIImagePNGRepresentation([UIImage imageNamed:@"userWhite"]);
[QBRequest TUploadFile:avatar fileName:@"avatar.png" contentType:@"image/png" isPublic:YES successBlock:^(QBResponse *response, QBCBlob *blob) {
// Success
} statusBlock:^(QBRequest *request, QBRequestStatus *status) {
} errorBlock:^(QBResponse *response) {
}];
圖片上傳:Image
下載頭像:
NSString* userProfilePictureID = [NSString stringWithFormat:@"%ld",(long)[[LocalStorageService shared] currentUser].blobID]; // user - an instance of QBUUser class
// download user profile picture
[QBRequest downloadFileWithUID:@"318547" successBlock:^(QBResponse *response, NSData *fileData) { UIImage* image = [UIImage imageWithData:fileData];
} statusBlock:^(QBRequest *request, QBRequestStatus *status) {
} errorBlock:^(QBResponse *response) {
}];
的UIImage不顯示任何圖像。我能做什麼? NSData
未損壞。
由於發現斑點UID,我有BlobID和UID之間的混淆。來自墨西哥的問候。 :) –