【发布时间】:2015-12-01 16:27:05
【问题描述】:
我正在尝试设置 IBM Mobile First Push Notifications。
我正在使用移动优先平台 7.1.0.00.20151107-1653
到目前为止我做了什么:
- 已创建 apns 沙盒证书并将其包含在应用的根文件夹中。
- 在 application-descriptor.xml 中添加了配置
- 将推送代码输入到我的适配器中,如https://github.com/MobileFirst-Platform-Developer-Center/EventSourceNotifications/blob/release71/adapters/PushAdapter/PushAdapter-impl.js 中所述
-
在我的客户端应用中添加了推送初始化功能:
var isPushSupported = WL.Client.Push.isPushSupported(); if (isPushSupported) { WL.Client.Push.registerEventSourceCallback( "myPush", "MetaAdapter", "PushEventSource"); WL.Client.Push.subscribe("myPush", { onSuccess: function(){ alert("success"); }, onFailure: function(errorMsg){ alert(JSON.stringify(errorMsg)); } }); }else{ console.log('---> Push not supported by device') }
之后,我将代码推送到我的服务器上(这也没有问题),我尝试启动该应用程序。在应用程序启动时,我允许出现典型的“您是否要允许此应用程序的推送通知”问题。
现在,当执行发布的代码时,onFailure 错误消息会显示为 500 - Unexpected Error。
在 XCode 控制台中,我可以看到以下输出:
{"errors":["A truncation error was encountered trying to shrink VARCHAR 'APP_NAME\/1.0.0 (iPhone; iOS 9.1; Scale\/2.00),Ma&' to length 254.
{prepstmnt 772646547 INSERT INTO PUSH_DEVICES (CREATED_MODE, CREATED_TIME, LAST_UPDATED_TIME, APPLICATION_ID, DEVICE_ID, ENVIRONMENT_ID, PUSH_KEY, LATITUDE, LOCALE, LONGITUDE, PLATFORM, STATUS, TOKEN, USER_AGENT, USER_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
[params=(String) API, (String) 2015-11-30T19:56:15Z, (String) 2015-11-30T19:56:15Z, (String) app_identifier, (String) 54D7CA02-64BA-4644-85E2-B29A0811FE6B, (String)
app_identifier-1.0.0, (null) null, (null) null, (null) null, (null) null, (String) A, (int) 0, (String) ef65cf4638308d13de9af9e09704cfdd9fe1010d3dcd678feb2aa8cf61a4b855, (String)
APP_NAME\/1.0.0 (iPhone; iOS 9.1; Scale\/2.00),APP_NAME...,
(String) 6dcd1097-1aa0-4111-af44-3234c29079e0]} [code=20000, state=22001]"],"isSuccessful":false,"warnings":[],"info":[]}*/
APP_NAME 长度为 21 个字符,app_identifier 长度为 52 个字符。
您有解决此问题的任何想法吗?
谢谢!
【问题讨论】:
标签: push-notification ionic ibm-mobilefirst