0
サンプルプロジェクトからこのコードを入手しました。Swift 4.0でQuickbloxを使用してプッシュ通知をプログラムで送信する方法は?
NSString *message = @"Hello man!";
NSMutableDictionary *payload = [NSMutableDictionary dictionary];
NSMutableDictionary *aps = [NSMutableDictionary dictionary];
[aps setObject:@"default" forKey:QBMPushMessageSoundKey];
[aps setObject:message forKey:QBMPushMessageAlertKey];
[payload setObject:aps forKey:QBMPushMessageApsKey];
QBMPushMessage *pushMessage = [[QBMPushMessage alloc] initWithPayload:payload];
[QBRequest sendPush:pushMessage toUsers:@"292,300,1395" successBlock:^(QBResponse *response, QBMEvent *event) {
// Successful response with event
} errorBlock:^(QBError *error) {
// Handle error
}];
私は私のために
let mesage = "Hello man!"
var payload = [String:String]()
var aps = [String:String]()
aps[QBMPushMessageSoundKey] = "default"
aps[QBMPushMessageAlertKey] = mesage
payload[QBMPushMessageApsKey] = aps //Cannot assign value of type '[String : String]' to type 'String?'
let message = QBMPushMessage(payload: payload)