我们可以使用quickBlox sdk从ios推送通知消息发布图片吗?任何身体帮助。
感谢。
答案 0 :(得分:2)
将图片上传到内容模块&发送它
NSData *file = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"YellowStar" ofType:@"png"]];
[QBContent TUploadFile:file fileName:@"Great Image" contentType:@"image/png" isPublic:YES delegate:self];
- (void)completedWithResult:(Result *)result{
// success result
if(result.success && [result isKindOfClass:QBCFileUploadTaskResult.class]){
QBCFileUploadTaskResult *res = (QBCFileUploadTaskResult *)result;
int uploadedFileId = res.uploadedBlob;
// Send push with file ID
NSString *mesage = @"Hello man!";
NSMutableDictionary *payload = [NSMutableDictionary dictionary];
NSMutableDictionary *aps = [NSMutableDictionary dictionary];
[aps setObject:@"default" forKey:QBMPushMessageSoundKey];
[aps setObject:mesage forKey:QBMPushMessageAlertKey];
[aps setObject:@uploadedFileId forKey:@"file_id"]; // this is file ID
[payload setObject:aps forKey:QBMPushMessageApsKey];
QBMPushMessage *message = [[QBMPushMessage alloc] initWithPayload:payload];
[QBMessages TSendPush:message toUsers:@"45288" delegate:self];
}