Push notifications for ios8

Hi, push Notifications is not working for us.

You say that “Solution: We are working on a solution when building for iOS 8 SDK. There is no issue when building with the public release build (2393a) running on either an iOS 7.x or iOS 8 device” 

We are running 2393 and its not working for us.

Then you are writing: “[Update]: The plugin has been updated to the latest iOS AdMob SDK and available in all Corona SDK builds”

So does it work for 2393 or not, and if its not working can you release a public version where its working. Its really trouble for us that when are game depends on push notifications. And we cant afford the the daily builds.

You need to give us something more than “Its not working”.  What’s not working? Are you getting errors?  Are you successful on iOS 7  devices?  How are you sending them?  Are you getting registered?

There’s a ton of things needed to get push notifications working (certificates, keys, profiles, etc.) that all have to be working correctly before you can be successful with push notifications.

Rob

At first, sorry for lack of information in the first post.

Everything works fine in iOs 7, in that os our application shows up in the list of applications that uses push notifications, but that is not the case in iOs 8.

I assume that certificates and such is correct, since it is working in iOs 7.

The core of the registration process is, which also assume is correct since it works for iOs 7 as well as for Android.

EDIT::: You were right, we are getting an error:
 

\<Warning\>: registerForRemoteNotificationTypes: is not supported in iOS 8.0 and later.

local function onNotification( event ) if event.type == "remoteRegistration" then local PushToken = event.token \_G.deviceId = event.token . . . Runtime:addEventListener( "notification", onNotification )

And this is the php-function that is sending the notifications.

We are getting “‘Connected to APNS’” and “‘Message successfully delivered’” as result, so there should not be any problem with connecting to apple server and such.

function send\_ios($alert,$message,$action,$id,$silentMode,$iosSound) { $passphrase = 'xxx'; $ctx = stream\_context\_create(); stream\_context\_set\_option($ctx, 'ssl', 'local\_cert', 'ck\_prod.pem'); stream\_context\_set\_option($ctx, 'ssl', 'passphrase', $passphrase); $fp = stream\_socket\_client( 'ssl://gateway.push.apple.com:2195', $err, $errstr, 60, STREAM\_CLIENT\_CONNECT|STREAM\_CLIENT\_PERSISTENT, $ctx); if (!$fp) exit("Failed to connect: $err $errstr" . PHP\_EOL); echo 'Connected to APNS' . PHP\_EOL; if($silentMode==true) { $body['aps'] = array( 'content-available' =\> 1, 'sound' =\> '' ); echo "silent for real"; } else { $sound = 'sound/ding.mp3'; if($iosSound==false) { $sound = ''; } // Create the payload body $body['aps'] = array( 'alert' =\> $alert, 'badge' =\> 0, 'sound' =\> $sound ); } $body['custom'] = array('action' =\> $action,'message' =\> $message); $payload = json\_encode($body); $msg = chr(0) . pack('n', 32) . pack('H\*', $id) . pack('n', strlen($payload)) . $payload; echo strlen($msg); // Send it to the server $result = fwrite($fp, $msg, strlen($msg)); if (!$result) echo 'Message not delivered' . PHP\_EOL; else echo 'Message successfully delivered' . PHP\_EOL; // Close the connection to the server fclose($fp); return $result; }

In the config files we are asking for notification permission for iOs.

if string.sub(system.getInfo("model"),1,2) == "iP" then application = { notification = { iphone = { types = { "badge", "sound", "alert" }, },

And at last in the build.settings file we do have:

 

iphone = { plist = { UIApplicationExitsOnSuspend = false, CFBundleShortVersionString = "6.0", FacebookAppID = "OUR APP ID", CFBundleURLTypes = { { -- This set of braces is important! CFBundleURLSchemes = { "fb OUR APP ID", } } }, CFBundleIconFile = "Icon.png", CFBundleIconFiles = { "Icon.png", "Icon@2x.png", "Icon-60.png", "Icon-60@2x.png", "Icon-72.png", "Icon-72@2x.png", "Icon-76.png", "Icon-76@2x.png", "Icon-Small.png", "Icon-Small@2x.png", "Icon-Small-40.png", "Icon-Small-40@2x.png", "Icon-Small-50.png", "Icon-Small-50@2x.png", }, }, },

And as mentioned we have the Build: 2014.2393.

Thank you for helping, and just write back if any information is missing.

I am having notification problem too. I can get notification. But I am not able to get anything in “launchArgs.notification” to get back those notification when the app was closed.

Have you solved the launchargs problem? Try this if ( launchArgs and launchArgs.notification ) then print( “event via launchArgs” ) notificationListener( launchArgs.notification ) end

You need to give us something more than “Its not working”.  What’s not working? Are you getting errors?  Are you successful on iOS 7  devices?  How are you sending them?  Are you getting registered?

There’s a ton of things needed to get push notifications working (certificates, keys, profiles, etc.) that all have to be working correctly before you can be successful with push notifications.

Rob

At first, sorry for lack of information in the first post.

Everything works fine in iOs 7, in that os our application shows up in the list of applications that uses push notifications, but that is not the case in iOs 8.

I assume that certificates and such is correct, since it is working in iOs 7.

The core of the registration process is, which also assume is correct since it works for iOs 7 as well as for Android.

EDIT::: You were right, we are getting an error:
 

\<Warning\>: registerForRemoteNotificationTypes: is not supported in iOS 8.0 and later.

local function onNotification( event ) if event.type == "remoteRegistration" then local PushToken = event.token \_G.deviceId = event.token . . . Runtime:addEventListener( "notification", onNotification )

And this is the php-function that is sending the notifications.

We are getting “‘Connected to APNS’” and “‘Message successfully delivered’” as result, so there should not be any problem with connecting to apple server and such.

function send\_ios($alert,$message,$action,$id,$silentMode,$iosSound) { $passphrase = 'xxx'; $ctx = stream\_context\_create(); stream\_context\_set\_option($ctx, 'ssl', 'local\_cert', 'ck\_prod.pem'); stream\_context\_set\_option($ctx, 'ssl', 'passphrase', $passphrase); $fp = stream\_socket\_client( 'ssl://gateway.push.apple.com:2195', $err, $errstr, 60, STREAM\_CLIENT\_CONNECT|STREAM\_CLIENT\_PERSISTENT, $ctx); if (!$fp) exit("Failed to connect: $err $errstr" . PHP\_EOL); echo 'Connected to APNS' . PHP\_EOL; if($silentMode==true) { $body['aps'] = array( 'content-available' =\> 1, 'sound' =\> '' ); echo "silent for real"; } else { $sound = 'sound/ding.mp3'; if($iosSound==false) { $sound = ''; } // Create the payload body $body['aps'] = array( 'alert' =\> $alert, 'badge' =\> 0, 'sound' =\> $sound ); } $body['custom'] = array('action' =\> $action,'message' =\> $message); $payload = json\_encode($body); $msg = chr(0) . pack('n', 32) . pack('H\*', $id) . pack('n', strlen($payload)) . $payload; echo strlen($msg); // Send it to the server $result = fwrite($fp, $msg, strlen($msg)); if (!$result) echo 'Message not delivered' . PHP\_EOL; else echo 'Message successfully delivered' . PHP\_EOL; // Close the connection to the server fclose($fp); return $result; }

In the config files we are asking for notification permission for iOs.

if string.sub(system.getInfo("model"),1,2) == "iP" then application = { notification = { iphone = { types = { "badge", "sound", "alert" }, },

And at last in the build.settings file we do have:

 

iphone = { plist = { UIApplicationExitsOnSuspend = false, CFBundleShortVersionString = "6.0", FacebookAppID = "OUR APP ID", CFBundleURLTypes = { { -- This set of braces is important! CFBundleURLSchemes = { "fb OUR APP ID", } } }, CFBundleIconFile = "Icon.png", CFBundleIconFiles = { "Icon.png", "Icon@2x.png", "Icon-60.png", "Icon-60@2x.png", "Icon-72.png", "Icon-72@2x.png", "Icon-76.png", "Icon-76@2x.png", "Icon-Small.png", "Icon-Small@2x.png", "Icon-Small-40.png", "Icon-Small-40@2x.png", "Icon-Small-50.png", "Icon-Small-50@2x.png", }, }, },

And as mentioned we have the Build: 2014.2393.

Thank you for helping, and just write back if any information is missing.

I am having notification problem too. I can get notification. But I am not able to get anything in “launchArgs.notification” to get back those notification when the app was closed.

Have you solved the launchargs problem? Try this if ( launchArgs and launchArgs.notification ) then print( “event via launchArgs” ) notificationListener( launchArgs.notification ) end