1

我正在尝试订阅推送通知。我正在使用此代码,但显示以下错误。告诉我如何解决这个问题

NSString *deviceIdentifier = [[[UIDevice currentDevice] identifierForVendor] UUIDString];

//  New way, only for updated backends
//
QBMSubscription *subscription = [QBMSubscription subscription];
subscription.notificationChannel = QBMNotificationChannelAPNS;
subscription.deviceUDID = deviceIdentifier;
subscription.deviceToken = deviceToken;

[QBRequest createSubscription:subscription successBlock:^(QBResponse *response, NSArray *objects) {

    NSLog(@"Successfully!");

} errorBlock:^(QBResponse *response) {

}];

错误是:

"Access-Control-Allow-Origin" = "*";
"Cache-Control" = "no-cache";
Connection = "keep-alive";
"Content-Length" = 45;
"Content-Type" = "application/json; charset=utf-8";
Date = "Thu, 11 Feb 2016 09:04:28 GMT";
"QB-Token-ExpirationDate" = "2016-02-11 11:04:28 UTC";
"QuickBlox-REST-API-Version" = "0.1.1";
Server = "nginx/1.6.2";
Status = "422 Unprocessable Entity";
"X-Rack-Cache" = "invalidate, pass";
"X-Request-Id" = abeab57301c1210afb8d01a6f23d7f47;
"X-Runtime" = "0.119512";
"X-UA-Compatible" = "IE=Edge,chrome=1";
4

1 回答 1

0

I have similar code and don't have a problem.
delegate.deviceToken is checked not-null.

QBMSubscription* qbm = [QBMSubscription subscription];
qbm.deviceUDID = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
qbm.deviceToken = delegate.deviceToken;
qbm.notificationChannel = QBMNotificationChannelAPNS;

[QBRequest createSubscription:qbm successBlock:^(QBResponse * _Nonnull response, NSArray<QBMSubscription *> * _Nullable objects) {
     NSLog(@"createSubscription.success");
} errorBlock:^(QBResponse * _Nonnull response) {
     NSLog(@"createSubscription.error=%@", response.error.description);
}];
于 2016-04-25T09:29:23.383 回答