Titanium JIRA Archive
Appcelerator Community (AC)

[AC-5484] Fail to sent ios notification.

GitHub Issuen/a
TypeBug
Priorityn/a
StatusResolved
ResolutionNeeds more info
Resolution Date2018-02-05T21:07:44.000+0000
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelsn/a
Reporterlau.yikonn
AssigneeShak Hossain
Created2018-01-03T06:35:18.000+0000
Updated2018-02-05T21:07:44.000+0000

Description

when i try to send an IOS notification, it show this error status. Exception Type: APNS; Error Code: 2010; Error Message: Socket is closed; Catched Exception: Socket Closed

Attachments

FileDateSize
Screen Shot 2018-01-03 at 2.28.37 PM.png2018-01-03T06:34:21.000+0000143577

Comments

  1. Mostafizur Rahman 2018-01-03

    Hello [~lau.yikonn], Thanks for sharing with us. Can you please share your sample code and environment details here so that we can reproduce the issue on our end? Best
  2. lau.yikonn 2018-01-04

    var Cloud = require('ti.cloud'); var app_status; if(Ti.Platform.osname == "android"){ var CloudPush = require('ti.cloudpush'); CloudPush.addEventListener('callback', function (evt) { var payload = JSON.parse(evt.payload); Ti.App.Payload = payload; // if trayClickLaunchedApp or trayClickFocusedApp set redirect as true console.log("callback push"); }); CloudPush.addEventListener('trayClickLaunchedApp', function (evt) { var payload = JSON.parse(evt.payload); receivePush(payload); console.log('Tray Click Launched App (app was not running)'); app_status = "not_running"; //getNotificationNumber(Ti.App.Payload); }); CloudPush.addEventListener('trayClickFocusedApp', function (evt) { var payload = JSON.parse(evt.payload); console.log('Tray Click Focused App (app was already running)'); receivePush(payload); app_status = "running"; }); } function getNotificationNumber(payload){ console.log(payload); } // Process incoming push notifications function receivePush(e) { console.log(e); console.log('receive push'); if(OS_IOS){ if(e.data.target == "chatroom"){ } }else{ if(e.target == "chatroom"){ } } //Action after receiving push message return false; } function deviceTokenSuccess(ex) { console.log("deviceTokenSuccess"); deviceToken = ex.deviceToken; Cloud.PushNotifications.subscribeToken({ channel: 'general', type:Ti.Platform.name == 'android' ? 'android' : 'ios', device_token: deviceToken }, function (sub) { console.log(sub); if (sub.success) { /** User device token**/ console.log(deviceToken+" push"); Ti.App.Properties.setString('deviceToken', deviceToken); } }); } function deviceTokenError(e) { alert('Failed to register for push notifications! ' + e.error); } function registerPush(){ if (Ti.Platform.name == "iPhone OS" && parseInt(Ti.Platform.version.split(".")[0]) >= 8) { // Wait for user settings to be registered before registering for push notifications Ti.App.iOS.addEventListener('usernotificationsettings', function registerForPush() { // Remove event listener once registered for push notifications Ti.App.iOS.removeEventListener('usernotificationsettings', registerForPush); Ti.Network.registerForPushNotifications({ success: deviceTokenSuccess, error: deviceTokenError, callback: receivePush }); }); // Register notification types to use Ti.App.iOS.registerUserNotificationSettings({ types: [ Ti.App.iOS.USER_NOTIFICATION_TYPE_ALERT, Ti.App.iOS.USER_NOTIFICATION_TYPE_SOUND, Ti.App.iOS.USER_NOTIFICATION_TYPE_BADGE ] }); }else if(Ti.Platform.osname == "android"){ CloudPush.retrieveDeviceToken({ success: deviceTokenSuccess, error: deviceTokenError }); }else{ Titanium.Network.registerForPushNotifications({ types: [ Titanium.Network.NOTIFICATION_TYPE_BADGE, Titanium.Network.NOTIFICATION_TYPE_ALERT, Titanium.Network.NOTIFICATION_TYPE_SOUND ], success:deviceTokenSuccess, error:deviceTokenError, callback:receivePush }); } } registerPush();
  3. lau.yikonn 2018-01-04

    im using the axway platform to send to all user.
  4. Motiur Rahman 2018-01-04

    [~lau.yikonn] Can you change this line of code? - if (Ti.Platform.name == "iPhone OS" && parseInt(Ti.Platform.version.split(".")[0]) >= 8) And use this - if ((Ti.Platform.osname === 'iphone' || Ti.Platform.osname === 'ipad' || Ti.Platform.osname === 'ipod') && parseInt(Ti.Platform.version.split(".")[0]) >= 8) Finally, delete the App from the device then reinstall it. Make sure the device has been subscribed successfully on the dashboard. Then send the push again. Hope this helps.
  5. lau.yikonn 2018-01-05

    it is not related with the code. i ask my friend to setup ios push notification at his appcelerator platform account. and then everything work fine. i think is something wrong with the configuration at platform there.
  6. Sharif AbuDarda 2018-01-08

    Hello, can you try configuring a new sample app and try sending push in there? Thanks.
  7. Mostafizur Rahman 2018-01-31

    Hello [~lau.yikonn],
 Just passing a followup here.Are you able to get that sorted out?  Please let us know if you need more help with this issue. Regards
 Axway Appcelerator Support

JSON Source