.net 后端错误的 Apns 设备注册 azure 移动服务 ios

Apns device registration azure mobile service ios with .net back end error

您好,出于某种原因我一直遇到重大问题,但无法弄清楚原因。

我正在注册设备注册:

- (void)application:(UIApplication *)application

didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
MSClient *client = self.authService.client;
[client.push registerNativeWithDeviceToken:deviceToken tags:nil completion:^(NSError *error) {
if (error != nil) {
NSLog(@"Error registering for notifications: %@", error);
}
}];
}

在过滤器响应方法中,如下所示:

- (void) filterResponse: (NSHTTPURLResponse *) response
                forData: (NSData *) data
              withError: (NSError *) error
             forRequest:(NSURLRequest *) request
                 onNext:(MSFilterNextBlock) onNext
             onResponse: (MSFilterResponseBlock) onResponse{
 **code omitted **
}

我回复了:

{ URL: https://hiddenAppName-mobile-app.azure-mobile.net/push/registrations%3FdeviceId=0F165A3BD554E4F4FCB8E412B537F2FE10B08FE1E2D1C168AE9EBE8A6DC15CA9&platform=apns } { status code: 200, headers { "Cache-Control" = "no-cache"; "Content-Encoding" = gzip; "Content-Length" = 483; "Content-Type" = "application/json; charset=utf-8"; Date = "Thu, 03 Sep 2015 21:11:01 GMT"; Expires = 0; Pragma = "no-cache"; Server = "Microsoft-IIS/8.0"; "Set-Cookie" = "ARRAffinity=6400fd48b4ba8e8bea4813afbd16c1ff61bacfd0d259c7c36e529f742a8de958;Path=/;Domain=hiddenAppName-mobile-app.azure-mobile.net"; Vary = "Accept-Encoding"; "X-Powered-By" = "ASP.NET"; } }

数据为:

[{"platform":"apns","deviceId":"0F165A3BD554E4F4FCB8E412B537F2FE10B08FE1E2D1C168AE9EBE8A6DC15CA9","registrationId":"3293417219461121655-5315545091225715647-20","tags":["CCE40A1696B14DADA2F005D554F970F6"],"templateName":null,"templateBody":null,"headers":{},"expiration":"2015-11-14T22:29:07.896Z"},{"platform":"apns","deviceId":"0F165A3BD554E4F4FCB8E412B537F2FE10B08FE1E2D1C168AE9EBE8A6DC15CA9","registrationId":"6230917652908957715-607108047627745508-20","tags":["13E1958EDF1D43AD8B5D9F61CF1203C8"],"templateName":null,"templateBody":null,"headers":{},"expiration":"2015-11-17T20:58:32.505Z"}]

当从 filterResponse 方法(上面)调用 onResponse 回调时,应用程序在 [MSLocalStorage commitDefaultsWithStorageVersion] 中崩溃了几次调用 出现此错误:

Property list invalid for format: 200 (property list dictionaries may only have keys which are CFStrings, not 'CFNull') 2015-09-03 22:18:58.778 hiddenAppName[2399:1160388] Attempt to set a non-property-list object { "" = "6230917652908957715-607108047627745508-20"; } as an NSUserDefaults/CFPreferences value for key hiddenAppName-mobile-app.azure-mobile.net-registrations 2015-09-03 22:18:58.779 hiddenAppName[2399:1160388] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Attempt to insert non-property list object { "" = "6230917652908957715-607108047627745508-20"; } for key hiddenAppName-mobile-app.azure-mobile.net-registrations' * First throw call stack:

(0x1829e022c 0x1946ac0e4 0x1829e016c 0x182a19fb4 0x18296c870 0x18296b850 0x182a1a2b0 0x182a19848 0x182a1d0d8 0x18380a960 0x10012ec00 0x10012e748 0x10011b78c 0x100121474 0x10007bce4 0x10007b734 0x10011ee7c 0x18245d1e8 0x18245d178 0x18245d2f4 0x18232fdfc 0x1823fa120 0x18231befc 0x1828c097c 0x18231bda8 0x18231bc5c 0x18231ba88 0x182997f8c 0x182997230 0x1829952e0 0x1828c0f74 0x18c31b6fc 0x1874c2d94 0x10001762c 0x194d56a08)

libc++abi.dylib: terminating with uncaught exception of type NSException

知道为什么有人这样吗?

处理空模板名称时存在错误,现已在 2.2.1 中修复。如果你更新到那个版本,你应该很高兴。 (修复:https://github.com/Azure/azure-mobile-services/commit/9347390